Host Graphics Now
Java Help
John's Home Page

Running Java Executables
Writing Java Classes
Java classes must each be contained in a separate file with the extension .java.  The file can be created with any text editor, such as Windows Notepad or DOS edit. 
Compiling Java Classes
Java classes are compiled with the javac program, which is supplied with the Sun Java Development Kit (JDK.)  After the JDK is installed, open a DOS window, change to the directory containing the Java source, and enter:
C:\dev\java>javac newclass.java
where newclass is the name of the class to be compiled.  If the compile is successful, a .class file will be output by javac. 
When one class imports another, the class being imported must be compiled before the class which uses the import.
Running Java Applications
Java applications are run with the java program, which is supplied with the Sun Java Development Kit (JDK.)  After the JDK is installed, open a DOS window, change to the directory containing the Java compiled application class, and enter:
C:\dev\java>java newapplication
where newapplication is the name of the application class to be run. 
Standalone applications must extend the application class, and must include a main method. 
Running Java Applets
Java applets are run with the appletviewer program, which is supplied with the Sun Java Development Kit (JDK.)  After the JDK is installed, open a DOS window, change to the directory containing the Java compiled application class, and enter:
C:\dev\java>appletviewer page.html
where page.html contains the applet to be run.  Multiple applets can be included in one page; the appletviewer program will open a window for each.
Getting and installing Sun JDK
Sun JDK
Sun Java Documentation
See Also:
Go To Cartesian Index


Go To Graphics Now Home Page
©1999, J.H.Young E-Mail Me

1