The installation and configuration process can be broken down into the following steps:
If you experience trouble along the way, check the Troubleshooting the Installation section at the end of this document.
1. Do pre-installation checks
The JDK software file and the JDK documentation file (available for download from step 2 of the JDK download page) should be unpacked in the same directory. Unpacking 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 any order. If you've already downloaded and installed the JDK documentation, you must unpack the JDK software file in the same directory from which you unpacked the documentation. For example, if you installed the JDK software at /usr/local/, then you should place the downloaded JDK software file in /usr/local/ before proceeding.
2. Unpack the downloaded software file
If you unpack the software or documentation in a directory that contains a directory named jdk1.1.3, the new software will overwrite files of the same name in that jdk1.1.3 directory. 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).
Note: substitute jdk1.1.3, etc. if appropriate.
% chmod a+x jdk1.1.4-solaris2-sparc.bin
% ./jdk1.1.4-solaris2-sparc.bin
% chmod a+x jdk1.1.4-beta-solaris2-x86.bin
% ./jdk1.1.4-beta-solaris2-x86.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.3 containing the JDK software, with the directory structure shown below.
Included in the unpacked 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 docs directory and its contents will be installed when you download and unpack the JDK documentation.
jdk1.1.3 _________________________|_____________________________________ | | | | | | | | | | | README CHANGES COPYRIGHT LICENSE bin lib include demo src docs index.html | _____________________________|____ | | | | | api tooldocs relnotes guide index.html | | | |
The src directory shown above originally appears as a src.zip file 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. Such unzip utitilities may be found at UUNet FTP Site.
3. Delete the original files you downloaded
If you want to recover disk space, delete the file you downloaded in step 1.
4. Update path and environment variables
The path variable enables Solaris to find the executables (javac, java, javadoc, etc.) from any current directory. To find out if the path is currently set for any java tools, execute:% which javaThis will print the path to the java tool, if it can find it.If you use the C shell (csh), you can set the path in your startup file (~/.cshrc) as follows, for example:
set path=($path /usr/local/jdk1.1.3/bin)Then load the startup file and verify that the path is set by repeating the "which" command above:% source ~/.cshrc % which java
If you follow the default installation, you do not need to set CLASSPATH, because the shell scripts automatically set it for you. If your CLASSPATH has not previously been set, you can skip this step.
- UNSETTING CLASSPATH
- 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 $CLASSPATHIf it is set, you can unset the current value by typing:% unsetenv CLASSPATHAlso 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.- WHAT CLASSPATH DOES
- The CLASSPATH tells the Java Virtual Machine and other Java applications (which are located in the "jdk1.1.3/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.zipwhere [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).
Refer to Solaris Troubleshooting the Installation
below if you have problems running the JDK.
Developing in both JDK 1.0.2 and JDK 1.1.3 - If you want to develop in both JDK 1.0.2 and JDK 1.1.3, you must set CLASSPATH and path separately for each JDK. To run both versions simultaneously, you can run each one from its own shell window. If you are running only one at a time, you can write a batch script to switch the values of the environment variables as appropriate.
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 step 4, 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.3, you can run the JDK's complier, javac, by doing either of the following:
Type:
/usr/local/jdk1.1.3/bin/javac myfile.java
-or-
Add
/usr/local/jdk1.1.3/bin
to your path statement
Type:javac myfile.java
You can start the AppletViewer by doing the following (once you've set your path as described above):
- 1. Use cd to change a directory containing an html file:
% cd jdk1.1.3/demo/TicTacToe- 2. Run the appletviewer on the html file:
% appletviewer example1.htmlDocumentation for all the JDK tools can be found in your installed JDK directory structure at jdk1.1.3/docs/tooldocs/solaris/index.html or on the tools reference page on the JavaSoft website.
% setenv CLASSPATH .:/usr/local/jdk1.1.3/lib/classes.zipThis will ensure that you are using the correct classes for this release.
% echo $JAVA_HOMEIf 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_HOMEIf 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.3
directory that was created when you installed the JDK. For example, if
you installed JDK 1.1.3, and the directory jdk1.1.3
has the
path /usr/local/jdk1.1.3
, you can try setting JAVA_HOME as
follows: % setenv JAVA_HOME /usr/local/jdk1.1.3As long as you have not disturbed the
bin
and lib
directories
that are immediately below the jdk1.1.3
directory, you should
be able to run the JDK tools.