Hello everyone Wanna compile and run java programs from a command prompt huh? don’t worry, I have explained this in very simple steps.
Many of you must be knowing that we can compile and run java programs with so many multi-language software, but what if you don’t have the software.
This software is not built-in for many OS but you have to download them and install them in your system. But you will definitely get a command prompt in each and every OS.
And now I will give you the way you can run and compile your java programs using your command prompt(cmd ). Just follow the instructions given below –
1) Open your command prompt.
Trick: press Windows + R and then type ‘ cmd ‘
To Compile java Program –
2) Type javac Demo.java
here ‘Demo’ I have my class name.
So now your program is compiled. And .class file is created. Now, this .class file is used to run the program completely.
To Run Java Program –
3) Type java ‘Demo’
Note: Type ‘java’ give ‘space’ type your class name.
Conclusion – These are some simple steps to how you can compile and run your java programs from the command prompt. So, now even if you don’t have a java editor, it will be easy for you to work with your programs
I hope this article will help you. In case you are having some problems is running your program, feel free to ask me using the comment section. Cheers!