Introduction to Java. A tutorial from A-SQUARE, Inc. January 2003

© 2000-2003 A-Square, Inc. Cambridge, MA

Platform Dependent Specifics

Wintel - CompileAnyJava script

Windows 98

Windows Xp

Wintel - RunAnyApplet script

Windows 98

Windows Xp

Wintel - RunRart script

The following scripts do what they are supposed to do as indicated. You should copy the one applicable to your platform into your folders MyEXxx.

When you doubleclick any bat-file, Wintel opens a black window and proceeds to execute the commands one by one, providing any errormessages both regarding the command itself and, in case of java, any output error messages that come about as the result of the execution of the java compiler or the appletviewer

Note: We have given the jdk1.1.8 folder the address c:\"jdk1.1.8". If in your system the jdk-folder has been placed elswhere, you may correct the path, the first line of the bat-file as presently given or, the preferred method, you move the jdk folder to the first level of your C-drive, that is so it is accessed through c:\"jdk1.1.8".

Wintel - CompileAnyJava script

These bat-files, when doubleclicked, open a command prompt window and invoke the java compiler javac on any files with the extension java.

The compiler compiles any java files to the corresponding classes with the same filename and the extension class which will be put in the same folder as the batch file. During the compilation, error or warning messages appear in the commmand promt window. The differences in the batch files are due to differences in how the command prompt window is closed.

Windows 98

In Windows98, the compiler generated error messages scroll off the top and so we minimize the number of lines. The following text should be copied and pasted into a blank Notepad window and saved as a file with the name CompileAnyJava.bat in your MyEXxx folders.

path c:\"jdk1.1.8"\bin
java -version
javac *.java

Windows Xp

In Windows Xp, the command prompt window disappear when the last command has been executed and so we add a command which keeps the window open until you hit a key. The window is scrollable, so you can retrieve any compiler generated error messages. The following text should be copied and pasted into a blank Notepad window and saved as a file with the name CompileAnyJava.bat in your MyEXxx folders.

path c:\"jdk1.1.8"\bin
java -version
javac *.java
ECHO *** Press Any Key to Continue ***
PAUSE >NUL

TOP

Wintel - RunAnyApplet script

These bat-files, when doubleclicked, open a command prompt window and invoke the appletviewer.

This script is similar to the CompileAnyJava script. One difference is that you for execution may need classes other than those explicitly provided in the MyEXxx folder. In order to ensure the availability, you set the classpath variable to point to any folders where you have provided additional classes. The classpath is set as a series of directories separated by ";"(Semicolon). In the bat files we have set the classpath to include all java classes as provided in jdk, as well as all classes provided in the hieracy topped by the the current folder, MyEXxx, which is designated "." (Period).

Note, that this script only works if there is one, and only one HTML document with an applet tag in the current folder, in which case the corresponding applet is executed in the appletviewer according to the values given in the applet tag. For some exercises, we have shown how to provide tracing informstion during execution using the Debug class. This and other messages appear during execution in the command prompt window and so we have again different versions of the script to ensure that you can read as much as possible of the output.

Windows 98

In Windows98, the compiler generated error messages scroll off the top and so we minimize the number of lines. The following text should be copied and pasted into a blank Notepad window and saved as a file with the name RunAnyApplet.bat in your MyEXxx folders.

path c:\"jdk1.1.8"\bin
set classpath=c:\jdk1.1.8"\lib\classes.zip;.
java -version
appletviewer *.html

Windows Xp

In Windows Xp, the command prompt window disappear when the last command has been executed and so we add a command which keeps the window open until you hit a key. The window is scrollable, however, so you can retrieve any messages generated during execution of the applet. The following text should be copied and pasted into a blank Notepad window and saved as a file with the name CompileAnyJava.bat in your MyEXxx folders.

path c:\"jdk1.1.8"\bin
rem set classpath=c:\jdk1.1.8"\lib\classes.zip;.
java -version
appletviewer *.html
ECHO *** Press Any Key to Continue ***
PAUSE >NUL

Wintel - RunRart script

We decided to include two versions of the RunRartscript. One is for use when you wish to be consistent with your JDK 1.1.8 environment. The other if you have installed the later runtime environment, for example the jre 1.4.0, Java 2 Runtime Environment. Please see the document "The Mechanics of Display and Distribution of a Rart Universe" for dtais regarding the operation of the RunRart script. Here we will just print the scripts which work as expected as long as you have installed the software as directed. If you have not, you will have to either move the software or modify the script.

If you have dragged the folder com to the top level of the C: drive and if you have installed jdk1.1.8 on the same top level the script specific to jdk1.1.8, called RunRart118.bat is as follows:

path C:\"jdk1.1.8"\bin
SET CLASSPATH=C:\jdk1.1.8\lib\classes.zip;C:\com\rart\classes.zip;.
java -version
java rr11.RR11
ECHO *** Press Any Key to Continue ***
PAUSE >NUL

If you have installed jre, Java 2 Standard Edition Runtime Environment as directed and the com file as above, the script, now called RunRartJ2SE.bat is as follows

path C:\jre\bin
SET CLASSPATH=C:\jre\lib\rt.jar;C:\com\rart\classes.zip;.
java -version
java rr11.RR11
ECHO *** Press Any Key to Continue ***
PAUSE >NUL

Between these two version you should also be able to figure out if something else has changed, especially if you wish to install a later version of jre.

TOP