Java IDE in C# with source code

By | January 4, 2020
Spread the love

How to create a Java IDE in C#? You can easily create a Java Ide in C#. These things are required in order to create a Java IDe in C#.

  1. Visual Studio
  2. Java JDK

Steps:

First, you have to download and install visual studio. Then download Java JDK in your computer and place it any drive make sure you have to place it accordingly to the code given below.

Open Visual Studio and create a new Windows Form Application Project in C#.

Design your form like below or you can simply type the following code into your Project.

Java IDE in C#

source Code of Java IDE in C#:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Java_IDE_in_cSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        private void button5_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("F:\\RunApp.bat");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            FontDialog f = new FontDialog();

            if (f.ShowDialog() == DialogResult.OK)
            {
                textBox1.Font = f.Font;
            }
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            ColorDialog colorDialog = new ColorDialog();

            if(colorDialog.ShowDialog() == DialogResult.OK)
            {
                textBox1.ForeColor = colorDialog.Color;
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            ColorDialog c1 = new ColorDialog();

            if (c1.ShowDialog() == DialogResult.OK)
            {
                textBox1.BackColor = c1.Color;
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            OpenFileDialog o = new OpenFileDialog();

            if (o.ShowDialog() == DialogResult.OK)
            {
                try
                {

                    textBox1.Text = System.IO.File.ReadAllText(o.FileName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Invalid File Selected", "Error Rised", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
                }
            }
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            SaveFileDialog s = new SaveFileDialog();

            string str = "";
            string str1 = "cd\\" + "\n F: " + "\n " + "cd jdk1.6\\bin" + "\n" + "javac " + textBox2.Text + ".java " + "\n java " + textBox2.Text + "\n pause";

            if(s.ShowDialog() == DialogResult.OK)
            {
                str = s.FileName;
                System.IO.File.WriteAllText(str,textBox1.Text);
                System.IO.File.WriteAllText("F:\\RunApp.bat",str1);
            }
        }

        private void label6_Click(object sender, EventArgs e)
        {

        }
    }
}
  •  
    78
    Shares
  • 76
  •  
  •  
  •  
  • 2
  •  
  •  
  •   
  •   
  •   
  •   
  •  

Leave a Reply

Your email address will not be published. Required fields are marked *