Sun Java Solaris Communities My SDN Account Join SDN
 
Archive - Java Technology Products Download

Installation Notes : JAVA 2 SDK, Standard Edition, Version 1.2.2 for Solaris Reference Operating Environments

 

Installation Notes

JAVA 2 SDK, Standard Edition, Version 1.2.2 for Solaris Reference Operating Environments

Solaris 2.6 and Solaris 7 SPARC-based Machines
and Solaris 2.6 and Solaris 7 Intel-based (x86) Machines

Japanese

Installation Instructions | Troubleshooting

Installation Instructions

In this procedure, you will run the self-installing executable to unpack and install the Java 2 SDK 1.2.2 software bundle. After that, you may either download and install the Java 2 SDK documentation bundle, or you may start using the newly installed Java 2 SDK!

The installation procedure has the following steps:

  1. If necessary, install Solaris patches
  2. Check the download file size
  3. Change to the directory you want to install into
  4. Unpack the downloaded file
  5. Delete the original file you downloaded (Optional)
  6. Update PATH variable
  7. Check the CLASSPATH variable (If upgrading)
  8. Start using the Java 2 SDK!
  9. Where Do I Go From Here?

Also see the system requirements.

If you have any difficulties, see the Troubleshooting section at the end of this document or use this link to report an installation problem.

Please note, for any command lines on this page containing the following notation, you must substitute the appropriate update version number for the notation.
       <version number>
For example, if you are downloading update 1.2.2_011, the following chmod command:
      % chmod a+x jdk-1_2_2_<version number>-solaris-sparc.sh
would become:
      % chmod a+x jdk-1_2_2_011-solaris-sparc.sh
1. If necessary, install Solaris patches
Prior to installing the Java 2 SDK, you should insure that you have installed the full set of required patches needed for support of this release. To obtain patches, see the SunSolve support website. You will find a patch cluster for each Solaris operating environment platform. Each patch cluster applies to all supported versions of the Java 2 Standard Edition (J2SE) on the given platform.

2. Check the download file size

Before you download a file, notice that its byte size is provided on the download page. Once the download has completed, check that you have downloaded the full, uncorrupted software file.

3. Change to the directory you want to install into.

For example, if you want to install the software in the /usr/local/ directory, then execute:
   % cd /usr/local
Unbundling the software in the next step automatically creates a directory called jdk1.2.2.

Note about the Java 2 SDK doc bundle - You can get the Java 2 SDK documentation bundle from the SDK download page. You should unbundle the Java 2 SDK software bundle and the SDK documentation bundle in the same directory. Unbundling them in the same directory ensures that HTML links between them will work properly. You can download and install the software bundle and the documentation bundle in either order.

4. Unpack the downloaded software file

Note about overwriting files - If you unpack the software or documentation in a directory that contains a subdirectory named jdk1.2.2, the new software will overwrite files of the same name in that jdk1.2.2 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 given below. Specify <path> to the download bundle, which can be a dot "." if installing into the current directory.

  • For SPARC:

    % chmod a+x jdk-1_2_2_<version number>-solaris-sparc.sh
    % <path>/jdk-1_2_2_<version number>-solaris-sparc.sh

  • For x86:

    % chmod a+x jdk-1_2_2_<version number>-solaris-i586.sh
    % <path>/jdk-1_2_2_<version number>-solaris-i586.sh

After you agree to the license, a directory called jdk1.2.2 is created and the software is installed into it.

Java 2 SDK Directory Tree
After installing both the Java 2 SDK software and documentation, the Java 2 SDK directory will have the structure shown below. The docs directory is created when you install the SDK documentation bundle.

                          jdk1.2.2
  __________________________|_______________________________
 |    |    |    |    |     |  |   |  |    |   |    |   |   |
 |    |    |    |    |     | bin lib |    |   |  demo  |  docs
 |    |    | LICENSE |     |  |   |  |    | src.jar   jre
 |    | COPYRIGHT  CHANGES |         |    |          __|__
 |  README            CHECKSUMS      | include      |     |
README.html                     include-old         bin   lib


5. Delete the original file you downloaded (Optional)
If you want to recover disk space, delete the file (or files) you originally downloaded.
6. Update PATH variable
You can run the Java 2 SDK just fine without setting the PATH variable, or you can optionally set it as a convenience.

Should I set the PATH variable?
Set the path variable if you want to be able to run the executables (javac, java, javadoc, etc.) from any directory without having to type the full path of the command. If you don't set the PATH variable, you need to specify the full path to the executable every time you run it, such as:

    % /usr/local/jdk1.2.2/bin/javac MyClass.java
Is the PATH already set?
To find out if the path is currently set for any java tools, execute:
  % which java
This will print the path to the java tool, if it can find it. If the PATH is not set properly, you will get the error:
    % java: Command not found
How do I set the PATH permanently?
To set the path permanently, set the path in your startup file.

For C shell (csh), edit the startup file (~/.cshrc):

  set path=(/usr/local/jdk1.2.2/bin $path)

For ksh, bash or sh, edit the profile file (~/.profile):

  PATH=/usr/local/jdk1.2.2/bin:$PATH
Then load the startup file and verify that the path is set by repeating the "which" command above:

For C shell (csh):

  % source ~/.cshrc
  % which java

For ksh, bash or sh:

  $ . $HOME/.profile
  $ which java
7. Check the CLASSPATH variable (If upgrading)
The CLASSPATH variable is one way to tell Java applications (including the SDK tools) where to look for user classes. (The -classpath command-line switch is the preferred way.) If you never set up the CLASSPATH variable for an earlier version of the SDK, you can ignore this step. Otherwise, you may want to clean up your CLASSPATH settings, so read on.

Should I modify the CLASSPATH variable?
The Java 2 SDK will work fine even if CLASSPATH is set for an earlier version of the SDK. However, if your CLASSPATH contains classes.zip for an earlier version, and you don't plan to continue using that version, you can remove that setting from the CLASSPATH now. If CLASSPATH is set but doesn't include the current directory, you should add the current directory to the CLASSPATH value.

How do I modify the CLASSPATH?
Use the same procedure you used for the PATH variable in the previous step and either:

  • Remove classes.zip from the CLASSPATH.
    (Leave any application-specific settings and the current directory, "." If CLASSPATH is set but doesn't include the current directory, you should add the current directory to the CLASSPATH value.), or
  • Remove the CLASSPATH environment variable entirely.
    (With the Java 2 SDK, the default value is "." (the current directory). For specific applications, you can use the -classpath command line switch.)

8. Start using the Java 2 SDK!

Your computer system should now be ready to use the Java 2 SDK. In this step, you'll run some simple commands to make sure it is working properly.

You start the compiler, interpreter, or other tool by typing its name at the shell window command line, generally with a filename as an argument. The SDK development tools need to be run from the command line and have no GUI interfaces (except AppletViewer). Double-clicking a tool's file icon, such as java, will not do anything useful.

You can specify the path to a tool either by typing the path in front of the tool each time, or by adding the path to the system as in the previous step. The following assumes the Java 2 SDK is installed at /usr/local/jdk1.2.2, and you have set the path variable. (If you have not, add /usr/local/jdk1.2.2 ahead of the javac and appletviewer commands.)

Compiling a Java class - You use the Java bytecode compiler, javac, to compile applications and applets that you write. Suppose, for example, that you have written an application in a file called MyApp.java. To run the compiler on your file, go to the prompt window and execute this:

       % javac MyApp.java
See the next section for link to Hello World examples.

Running Applets - You can run applets in AppletViewer. Here's an example:

  • Use cd to change to the TicTacToe directory that contains the html file example1.html that embeds an applet:
        % cd jdk1.2.2/demo/applets/TicTacToe
    
  • Run AppletViewer with the html file:
        % appletviewer example1.html
    
    This example lets you interactively play Tic-Tac-Toe.

Refer to the Troubleshooting section below if you have problems running the SDK.

9. Where Do I Go From Here?
At this point, you will probably want to install the documenation bundle, if you have not already done so. Although you can use the SDK tools without installing the documentation, it makes sense to do so if you are going to do any extensive work. You can get the SDK documentation bundle from the Java 2 SDK download page. Click here for documentation bundle installation instructions.

You can also go to:

Troubleshooting the Installation

Below are tips for working around problems that are sometimes seen after an installation. For additional troubleshooting information, see the troubleshooting section of the Java FAQ.

  • Error Message: The download file appears to be corrupted
    The Java 2 SDK'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.
To submit comments or suggestions about the Java 2 SDK, please send mail to the most appropriate engineering team from the list at Java Software email addresses.