Readme.txt for MyPhysicsLab java applets. There are currently three applets available: Lab -- contains most of the MyPhysicsLab simulations Thruster5 -- the rigid body collisions simulation simple -- a simplified text-only version for students ========================== License ========================== This is a version of the source code for the MyPhysicsLab java applet. It is provided under the GNU General Public License, see the attached file 'copying.txt'. The author is Erik Neumann. Contact me at erikn@MyPhysicsLab.com. The website where this code is available is https://www.MyPhysicsLab.com =========================== Compiling Lab.java =========================== To compile the Lab source code, obtain the Java 2 SDK (software development kit) from https://java.sun.com/ and install it. The Java 2 SDK version 1.4 is required as of May 2002. The Java 2 SDK version 1.3 may be used by making some small modifications to the file Lab.java (search for '1.4' in that file). To compile each file, type the command javac file.java -target 1.1 where 'file' is replaced by each of the java files in the distribution (note that upper and lowercase letters do matter here). (The "-target 1.1" tells the compiler to generate .class files that are compatible with java 1.1 which is what is built in to Internet Explorer). The files need to be compiled in the following order: Simulation.java sim1.java sim2.java sim3.java roller.java Lab.java The resulting application can be run in 'standalone' mode by the command java Lab Currently, only one simulation is available in this mode. To change which simulation is shown, you must edit the appropriate line in the Lab.java file (its toward the end of the file). Or you can use the resulting applet from in a web page, see the examples at www.MyPhysicsLab.com, or the accompanying file test_applet.html. ========================= Compiling Thruster5.java ========================= This is the applet for the rigid body collisions simulation. I recommend compiling these files in a separate directory from the Lab.java files to avoid possible conflicts with classes that have the same name. Also, delete all .class files before you start to ensure there are no old versions around. You first need to compile the file SimApplet.java which yields several class files (such as SimApplet, SimCanvas, SimLayout1, etc.) javac SimApplet.java -target 1.1 Next compile Thruster5.java which creates several more class files. javac Thruster5.java -target 1.1 You can now run in application mode by java Thruster5 (Note that if you want to run the 'sumo wrestling' game version you will need to change the appropriate boolean variable.) ========================== Compiling simple.java ========================== This is a simplified text-only version of a spring simulation. Instructions for compiling are included as comments at the start of the file 'simple.java'. ========================= JAR files (optional) ========================= Note that it is NOT necessary to make a .jar file, but it helps speed download times. To combine the various java class files into a single compressed .jar file use the command jar cfm Lab.jar LabMainClass.txt *.class The file LabMainClass.txt should contain the single line: Main-Class: Lab which tells what class to start up if running standalone from the .jar file. see https://java.sun.com/j2se/1.3/runtime.html The manifest is necessary for using the jar file in standalone mode, with java -jar Lab.jar If you are developing changes to the applet, you should delete the .jar file from your development directory so that it is not used by web pages. Instead the *.class files will be used. =========================== Standalone Application Mode =========================== To run as an application (instead of an applet in a browser) type java -jar Lab.jar Or, delete the Lab.jar file and you can run directly from the *.class files by typing java Lab ============================== TO DEBUG WITH PRINT STATEMENTS ============================== Put statments into your code such as: System.out.println("value = "+value); where 'value' is a variable you want to see. Note that if running in a browser you must 'show console' to see the print statements. ================= TO DEBUG WITH JDB ================= JDB is the java debugger supplied by Sun. It allows you to set breakpoints and examine variables while running the application. Here are the steps to use jdb: 1. compile with the debug option: javac -g simple.java 2. start running with the jdb debugger jdb simple 3. set a breakpoint by: stop at class:line where 'class' is replaced by a class and 'line' by a line number here's an example: stop at Lab:138 4. type: run the window for the app will open and start running. the debugger will stop execution at the line you specified. 5. use the jdb commands such as: stop at, step, next, cont, print, where, locals type: help to see a list of available commands (type these into your DOS prompt window, not into the application!) ========================== Other files ========================== The other files included with this distribution are: copying.txt -- a copy of the GNU General Public License readme.txt -- the file you are reading LabMainClass.txt -- for creating .jar files test_applet.html -- for testing the applet