Java compile and run with command prompt

67 Views
Published
compile and run Java with Command Prompt

#java #compile #run #command #prompt
----------------------------------------
1. Make sure you have a Java JDK installed (we did this in lesson #1)
2. (optional) use a text editor and save a file as .java
3. Open Command Prompt (Windows) or Terminal (Mac) on your computer
4. set path=C:\Program Files\Java\jdk-14.0.1\bin (where JDK is located)
5. cd C:\Users\Myname\Desktop (or wherever you java file is)
6. javac HelloWorld.java (to compile a .java file to .class file)
7. java HelloWorld (to run a .class file, it's portable)
Category
Bro Code
Tags
running java from command line, java hello world notepad, java hello world cmd
Be the first to comment