- Run java program in Cmd.
- Run java program in Eclipse Ide.
1) Run java program in CMD
- Firstly, you could download the JDK because it is a necessary thing when you run java program
- After Download set of the path in JDK
- subsequently, make a new folder and the name the folder is "java" in your Desktop.
- After that open the notepad(editor) which helps to write code and type the simple java program as below.
class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello, World!");
System.out.println("Welcome to java overflow");
}
}
- copy the code and past your editor.
- After save Run java program name > HelloWorld.java
- you can understand first of all the file name and class name is equal because if you don't do it so you phase error so I suggest.
- Then after open the run menu you show at the image and after type CMD then press the enter.
- After that, you set the program folder pathname which is given by yourself
- our case, this code looks like > cd Desktop > cd java
- Then type: javac HelloWorld.java
- Show your Java folder in the .class file generate it's your HelloWorld.class,
- it's java compiler generate the .class file its "byte code" form.
- Then type > javac HelloWorld
- Show the image in the wrong class name should be not allowed
- So type carefully and type the right name and then hit Enter.
- Then java program run and show output your code.
- so it's all about in the Run java program in cmd
2) Run java program in eclipse
- First set of the JDK path.
- After Download the Eclipse Ide in 👇below link (Relative your operating system)
- After download the eclipse zip file to convert the normal file and open the setup.exe file.
- click open and run after install and accept all agreement and license
- Click on the eclipse ide for enterprise java developers(you can also download Eclipse ide for java Developers)
- After clicking on the launch and then one by one configuration the teams and condition
- open the eclipse and show this below view👇
- Create a new java project and give the name of the run java program
- Ignore modify filename and enter don't create
- Click on the src folder and create a new java class file the same as the picture
- Copy This code and run a java application
class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello, World!");
System.out.println("Welcome to java overflow");
}
}
- right-click on the src folder and run as a java application and hit the enter
- show This run button end hit enter.
- show console in the output.