The first thing you have to do is open up the command line. Do that by launching "Windows Command Prompt":
Open up the start menu on your computer and type "cmd", then hit enter. It will launch the cmd.exe file and then the command prompt should pop up.
The easiest way is to navigate to the file in Windows Explorer, and then hold SHIFT and right click on any white space in the directory.
Then choose the option "Open command window here".
If you do that, you can move on to step 3.
You have to locate where your .java file is on your computer. Once you have found the location, navigate there in the command prompt.
You can type the address yourself, or copy it from windows explorer. You can copy the location three ways:
Right clicking the .java file and going to properties. It should then list the location of the Java file for you.
Right clicking the final location in Windows Explorer location bar and clicking "Copy adress as text":
Left clicking the location bar anywhere besides a location (whitespace). Look to the red highlighted box in the picture below. It will bring up plain text that you can copy.
But keep in mind that if it's in a library such as Desktop, Documents, etc., the copied address may not work because it's not the raw address in your drive.
For example, it may be copied as "Documents" instead of "C:\Users\Your_User\Documents".
Then type cd location into the command line (where location is the location of the file). For example, if your Java file called Test.java is located in the directory: C:\Users\Mike\Documents\Test\Test.java, you will type this into the command line:
Then hit enter and it should bring you to that location.
After that, you need to compile your .java file manually (using the command line).
Type the following into the command line and hit enter: javac YourClassName.java
You should receive no feedback, but also no errors. You should just be able to type a new line into the command line.
What you just did was compile the .class file (notice the "c" in "javac" - it means "compiler"). Look at the directory with your .java file and you should also see a .class file.
And finally, you can run your Java class by using the .class file you just generated.
Type the following into the command line and hit enter: java YourClassName
Notice to not add the "c" at the end of "java" and to take out the ".java" from your file completely.
Created: June 2, 2015
Completed in full by: Michael Yaworski