Save the program as "MyFirstApp.java".
Open the CLI (Command Line Interface aka Command Prompt).
Change the directory to the directory of the file (If you saved the file in C:\Users\cc11rocks\JavaStuff), then type:
Then, type in (to compile the program):
If nothing seems to happen, it made the byte file properly.
Then, to run the program, type in (to run the program):
You should see "I Rule" on the next line and then back to command line with a blinking cursor. Congrats, you have compiled and ran a Java program!
cc11rocks aka John Price
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Joined: May 10, 2011
Okay, I think the reason it doesn't work is because java is case sensitive. Is that correct?
I can't remember whether this is stated explicitly, but a successful run of the javac tool produces no output
myprompt > javac MyFile.java
If nothing happens, you must assume it was successful. If anything went wrong, there would be an error message. Then you try
If you are still having trouble with it what i do is make a folder on my desktop and name is whatever then when you got done making a code file and save it to C:\user\your name\desktop\whatever file then save as myfile.java then go to cmd put in cd\ enter then type c:\user\desktop\whatever\ then you go javac myfile.java will complie and make a myfile.class then java myfile then will show what you did.