|
How to set up your Windows 95/98/NT machine to run Java:
Download JDK1.1.8 from Sun - click here and follow the detailed instructions to set up and test the installation. Note: you can also use the latest JDK1.2.2 if you like - it has many new features.
Make a directory in which you will compile and run your Java programs, for example C:\MolSim\>
Download simulate.jar into this working directory. If you wish, unpack it:
C:\ComPhys\>jar xvf simulate.jar
Above information taken from Prof. Gonsalves' Computational Physics course site.
Summary of steps in setting up and running your Java code
Write your source code in a file with a .java extension. The name of the file should be the same as the name of the class defined in the file. Let us say that the name you choose is filename.java
Make sure you have the simulate.jar file in your current directory.
Compile your source using the command javac -classpath simulate.jar filename.java this should create the file filename.class in your directory
Run the code as follows
- if your program is an application, execute the command
java filename.class
- if your program is an applet, run it using an appletviewer
appletviewer filename.class or create an html file that uses the applet, and load this into a browser. |