I'm not going to tell you about the syntax of the java program.I want to show simply run java program with cmd.
1.At first you have to open a text editor like notepad or notepad++.So,open that.
2.Click file>save as and save that file in C drive in the folder any name such as test named youtube.java or anything else.It must be with .(dot) java extension file.Because it is important for java program.
3.Now write a simple hello world java program like it.
4.
class apples{
public static void main(String args[]){
System.out.println("hello world");
}
}
5.Then save it(cntr+S).
6.After that open cmd and write the instructions below and press enter.
cd \ >dir > cd test >dir > javac youtube.java > dir > java.apples.
7.Write one by one and press enter.Then you can see the last output "Hello world" or "my name is khan"
Here is some screenshots for your help.
Screenshots
Step one
Step two
Step three
Step four
Step five
Step six
Step seven
Step eight
So in this way you can run a java program with cmd.So,if the instructions are helpful to you then please comment and subscribe.
No comments:
Post a Comment