How To Run Java To compile and run a Java program on studsys your Java source code must be in a file ending with .java, for instance MyProg.java . The name of the file must match the name of the public class defined in the file. You compile the program by typing: javac MyProg.java This will create new .class files in the current directory corresponding to any classes defined in your program. If your program is an application you can run your program by typing: java MyProg If your program is an applet (e.g. MyApp.java), then you must create an HTML file which refers to the applet. For instance, you could create a directory to work in with mkdir and then move to that directory: mkdir First cd First Then type in the code for your applet into MyApp.java and put a line defining the applet into MyApp.html. For instance, you could use: Then compile the applet: javac MyApp.java Once the HTML file is written, you can view it using a web browser, or the appletviewer program. To display the applet using appletviewer, you need to be running an X-windows server (for instance, any of the connections to studsys from the MSCS labs will work). You start appletviewer with the command: appletviewer MyApp.html This will cause a new window to open up on your desktop and display the applet. One of the advantages of using appletviewer is that you can make changes and see the new applet each time - this is harder to accomplish with some web browsers. You can also load the applet directly into Netscape by specifying the directory location of the HTML file. If you have followed the above directions, your file is in the First subdirectory of your home directory. You would load this into the browser by choosing Open Page from the File menu, then click the Choose File... button to get a file choice window. Move into the First directory and choose MyApp.html (to Open in Navigator).