Compiling Java
Download
Report
Transcript Compiling Java
How to Compile Java in
Windows
click start
then run
type cmd into dialog
This is a
shell window
Once you have saved the Java files from the course
web site to some folder, type
cd Folder_Path_Of_Java_Files
into the shell window.
E.g if the files are in H:\Bill then I type
cd H:\Bill
Note, you can paste the path name from the Windows explorer that you use
to see your folders.
Right Mouse Click inside the shell window pastes from the clipboard.
To compile a file MyJavaFile.java type into the
shell window:
javac MyJavaFile.java
Then to run the program with the Java interpreter
type:
java MyJavaFile
NOTE: There is no file extension, just the name
of the application we have created.
When you want to stop the java program type
C-c
that is hold down the control key and then
the ‘c’ key.
Sometimes when you make changes to the Java source files the java compiler does
not always notice when you recompile the program.
If you have changed a program and it looks like there is no change when you run it
try deleting all the ‘.class’ files in the folder. Then recompile and
run the program again.
You can do this by selecting them and deleting them in windows explorer