You need to install a JDK (Java Developer Kit or J2SE) on your machine in order to compile the examples. The minimum version required is version 1.4. You can download the JDK from java.sun.com/downloads. Follow the installation instructions there to make sure both the java and javac executables are in your path.
javac
The examples in the JMSL Application Quick
Start Pack can be compiled simply by typing javac Demo.java
at
a command prompt. If you need help using javac, you can type javac -help
,
consult a reference book, or read through Sun's online
tutorial.
You may wish to create your own build environment to help build all the examples at once, for example. We would recommend using Ant to aid in this task. Ant is essentially a make utility for Java. While configuring Ant is outside the scope here, we do provide a build.xml file for your convenience here.
Java
The examples here are all included in a package. As such, there are two things to be aware of.
1) The root of the package must be in your
CLASSPATH. For example, if the code exists in /opt/jmsl/classes/com/imsl/demo/WallStreet,
it is in the package com.imsl.demo.WallStreet
and the directory
/opt/jmsl/classes must be in the CLASSPATH.
2) You must address the class with its full
name. For the case above with the proper CLASSPATH set, you can execute the
code with Java com.imsl.demo.Wallstreet.Wallstreet
.
The CLASSPATH environment variable allows
the Java executable to find all the classes it needs. When building the CLASSPATH,
remember that listed directories include all the classes and packages in that
directory, while jar files need to be added explicitly. You may also set the
CLASSPATH at runtime by using java -cp
.
Setting the CLASSPATH depends on your operating system and shell environment. Each of the following examples (except the final one) set the CLASSPATH and then echo it to the screen. Note that "." indicates the current directory.
$ set CLASSPATH = .:/opt/jmsl/classes:/opt/jmsl/lib/jmsl.jar:/opt/jmsl/lib/swing_look_and_feel_icons-1_0.jar
$ export CLASSPATH
$ echo $CLASSPATH
% setenv CLASSPATH .:/opt/jmsl/classes:/opt/jmsl/lib/jmsl.jar:/opt/jmsl/lib/swing_look_and_feel_icons-1_0.jar
% echo $CLASSPATH
C:\> set CLASSPATH = ".;c:\jmsl\classes;c:\jmsl\lib\jmsl.jar;c:\jmsl\lib\swing_look_and_feel_icons-1_0.jar"
C:\> echo %CLASSPATH%
Control Panel | System | Advanced | Environment Variables...
For all users, click New... under "System variables"; for the current user only, under "User variables for username"
Variable Name: CLASSPATH
Variable Value: .;c:\jmsl\classes;c:\jmsl\lib\jmsl.jar;c:\jmsl\lib\swing_look_and_feel_icons-1_0.jar
Click OK and exit all the other dialogs.
An executable jar file containing all of
the demos referenced in this guide is included in the jmsl/lib directory.
On Windows, you may double-click the file to run it if files with a ".jar"
extension are properly registered with javaw.exe. Alternatively, for
both Windows and UNIX environments, the jar file may be executed from the command
line using java -jar gallery.jar
. No CLASSPATH or extra settings
are required.
A list of buttons, one for each demo, is created. Demos can be subsetted as they relate to specific areas (Math, Stat, Finance, Charting) by choosing the appropriate selection on the JComboBox. To run the Additional Demos, select Quick Start in the JComboBox.