The installation and configuration process can be broken down into the following steps:
Troubleshooting the Installation
Before proceeding further, check that you have downloaded the full, uncorrupted software file:
jdk-1_1_8_005-solsparc.bin |
10,117,078 bytes |
jdk-1_1_8_005-solx86.bin |
9,707,216 bytes |
You should unbundle the JDK software bundle and the JDK documentation bundle in the same directory. (The doc bundle is available for download from step 2 of the JDK download page.) Unbundling them in the same directory ensures that links between HTML files will work properly.
You can download and install the software file and the documentation file in either order. If you've already downloaded and installed the JDK documentation, you should unbundle the JDK software file in the same directory from which you unbundled the documentation. For example, if you installed the JDK documentation at /usr/local/, then you should place the downloaded JDK software file in /usr/local/before proceeding.
If you unbundle the software or documentation in a directory that contains a directory named jdk1.1.8, the new software will overwrite files of the same name in that jdk1.1.8directory. Please be careful to rename the old directory if it contains files you would like to keep.
In a shell window, execute the commands listed below. Note that this temporarily creates a README file in the current directory (which will overwrite any README file you might have).
% chmod a+x jdk-1_1_8_005-solsparc.bin
% ./jdk-1_1_8_005-solsparc.bin
% chmod a+x jdk-1_1_8_005-solx86.bin
% ./jdk-1_1_8_005-solx86.bin
This will bring up a license for you to read. If you agree, type yes, hit Return, and it will create a directory called jdk1.1.8containing the JDK software, with the directory structure shown below.
Included in the unbundled files is a file lib/classes.zip. DO NOT UNZIP THE CLASSES.ZIP FILE. This file contains all of the core class binaries, and must remain in its zipped form for the JDK to use it.
JDK Directory Tree
The JDK software and documentation directories will have the following structure. The docsdirectory and its contents will be installed when you download and unbundle the JDK documentation.
jdk1.1.8
_________________________|________________
| | | | | | | | | | |
README | | | bin lib | demo | docs |
CHANGES | | | | include | src | |
COPYRIGHT | | | | |
LICENSE index.html
The srcdirectory shown above originally appears as a src.zipfile in the Solaris installation, which you may manually unzip to obtain access to the source code for the JDK class libraries. However, you must use an unzip program that maintains long files names.
If you want to recover disk space, delete the file you downloaded.
It is possible for you to run the JDK without modifying any system environment variables (such as PATH or CLASSPATH) or modifying your startup file (~/.cshrc). However, you should test that CLASSPATH is not set, and most developers set PATH as a convenience.
Set the path variable if you want to be able to run the executables (javac, java, javadoc, etc.) from any directory. If you don't set the path variable, you need to specify the path to the executable when running it. The path variable is merely a convenience to the developer and not necessary to set.
%
which java
This will print the path to the java tool, if it can find it.
set path=($path /usr/local/jdk1.1.8/bin)
%
source ~/.cshrc %
which java
If you follow the default installation, you do not need to set CLASSPATH, because the compiler and other tools automatically find the Java platform classes. If your CLASSPATH is currently not set, you can skip this step.
If you have previously set the CLASSPATH variable and want to unset it, you normally need to change the current value (at the command line) and the startup value (in your startup file or script). To see if it is currently set, type:
%
echo $CLASSPATH
If it is set, you can unset the current value by typing:
%
unsetenv CLASSPATH
Also open your startup file (~/.cshrc) or script and remove the path to the JDK classes from the CLASSPATH environment variable if you want the change to be permanent.
The CLASSPATH tells the Java Virtual Machine * and other Java applications (which are located in the "jdk1.1.8/bin" directory) where to find the class libraries, such as classes.zip file (which is in the lib directory). By default, the java tools temporarily append the following to whatever CLASSPATH you have explicitly set in your startup file:
.:[bin]/../classes:[bin]/../lib/classes.zip
where [bin] is substituted by the absolute path to the jdk1.1/bin directory. Therefore, if you keep the bin and lib directories at the same directory level (that is, if they have a common parent directory), the Java executables will find the classes. You need to set the CLASSPATH only if you move classes.zip or want to load a different library (such as one you develop).
Your computer system should now be configured and ready to use the Java Development Kit. You start a tool by typing its name at shell window command line, with a filename as an argument. If you didn't set the path variable to point to the tools in the previous step, you must specify the path to a tool by typing the path in front of the tool.
For example, if the JDK is installed at /usr/local/jdk1.1.8, you can run the JDK's complier, javac, by doing either of the following:
Type: /usr/local/jdk1.1.8/bin/javac myfile.java
-or-
Add /usr/local/jdk1.1.8/bin to your path statement
Type: javac myfile.java
Refer to Solaris Troubleshooting the Installation below if you have problems running the JDK.
The AppletViewer is a application for running and viewing applets in a window. You can start the AppletViewer by executing the following, assuming you have already set your path (as described above):
% cd jdk1.1.8/demo/TicTacToe
% appletviewer example1.html
Documentation for all the JDK tools can be found in your installed JDK directory structure.
The JDK's installation script does a checksum to insure that the software bundle was not corrupted during the download. If the checksum indicates that your file is corrupted, delete the file and download a new copy.
If you are getting the fatal error message: Exception in thread NULL, when running java, javac, or appetviewer, you should check your CLASSPATH environment variable. It may list the 'classes' directory from an older JDK release. You can either unset the CLASSPATH variable, or set it to include only the latest version of the JDK class library. For example:
% setenv CLASSPATH .:/usr/local/jdk1.1.8/lib/classes.zip
This will ensure that you are using the correct classes for this release.
If you get this error message when running one of the JDK tools such as the appletviewer, it may mean that your JAVA_HOME environment variable is not set properly. Normally, you shouldn't have to worry about setting JAVA_HOME. However, some Java IDEs set the JAVA_HOME variable to a value that won't allow you to run from the JDK. Check to see if your JAVA_HOME value has been set by using the echo command:
% echo $JAVA_HOME
If a value is set for JAVA_HOME, unsetting it should allow you to run the JDK tools. You may want to make a note of the current JAVA_HOME setting before you unset it, in case you want to restore it later. You can unset the JAVA_HOME environment variable as follows:
% unsetenv JAVA_HOME
If you still cannot run the JDK tools after unsetting JAVA_HOME, you can try setting JAVA_HOME to the absolute path of the jdk1.1.8 directory that was created when you installed the JDK. For example, if you installed JDK 1.1.8, and the directory jdk1.1.8 has the path /usr/local/jdk1.1.8, you can try setting JAVA_HOME as follows:
% setenv JAVA_HOME /usr/local/jdk1.1.8
As long as you have not disturbed the bin and lib directories that are immediately below the jdk1.1.8directory, you should be able to run the JDK tools.
This error message indicates that your JAVA_HOME environment variable has been set to a value that is not compatible with running the JDK tools. You should try to correct the problem by following the suggestions given above under "Error Message: Could not read properties file".
AppletViewer allows you to run one or more Java applets that are called by reference in a web page (HTML file) using the APPLET tag. The AppletViewer finds the APPLET tags in the HTML file and runs the applets (in separate windows) as specified by the tags.
AppletViewer is for viewing applets. It cannot display an entire web page that contains many HTML tags. It parses only the APPLET tag and no other HTML on the web page.
To run an applet with appletviewer, you go to a command line for your operating system and run appletviewer, passing in the filename or URL of the web page as its argument.
Here is an example of how to invoke AppletViewer on a file-based web page in Windows. Go to a DOS prompt, change to the "jdk1.1.8" directory and then execute:
%
bin/appletviewer demo/GraphLayout/example1.html
bin/appletviewer #
Debugging Programs With The Java Debugger (Jdb)
You can debug applets using the -debug option of appletviewer. When debugging applets, it's best to invoke appletviewer from the directory that contains the applet's HTML file. For example, on the PC:
cd demo/TicTacToe ../../bin/appletviewer -debug example1.html
You can find documentation on the debugger and its API at:
*As used on this web site, the terms "Java virtual machine" or "JVM" mean a virtual machine for the Java platform.