Installation and Configuration Notes

Introduction

The Java Development Kit is distributed in self-installing bundles for Win32 and Solaris. These bundles are executable files that extract the JDK software into the installation directories. On Win32 systems, the installer also sets various registry entries to record installation information.

You will need to perform some final configuration steps by hand. This consists primarily of making certain various environment variable are properly set. There are also various configuration problems you may have to solve to get full use out of your JDK software.

For a summary of JDK software files, see the Overview of the Java Development Kit.

Important Environment Variables

The JDK software uses the same set of environment variables on Solaris and Windows, though some details are platform-specific. These are the important environment variables:

PATH
Should include the bin directory in your JDK software installation. This makes it easier to run the development tools.

CLASSPATH
In this release, CLASSPATH should be less of a headache than it used to be. In some previous releases, a careless setting could disable the Core API, and even the development tools! In this release, the "system classes" are accessible no matter what you set CLASSPATH to.

You do want CLASSPATH to point to any "user classes" you're using. These include any classes you've compiled with the javac tool, so you will probably want "." (the current directory) in your CLASSPATH. Some applications, such as Netscape Navigator, rely on CLASSPATH to find their own class libraries.

If CLASSPATH isn't set, JDK software assumes the user classes are all in the current directory.

JAVA_COMPILER
The name of a Just-In-Time bytecode compiler. A JIT compiler can greatly improve performance by compiling class bytecodes into native machine code. On Win32, you can enable the bundled Symantec JIT Compiler by setting this variable to "symcjit". On Solaris, the JIT is named "sunwjit".

Windows

Runing The Development Tools

The JDK development tools are designed to be run from the command line. Double-clicking a tool's file icon, such as java.exe, will not do anything useful. On the other hand, the JDK development tools are all 32-bit applications, and cannot run if the full Win32 environment is not active. The right way to run the JDK development tools is from the a Command Line window running under the Windows GUI.

You can always run a tool by giving its full path name. For example, if you've installed the JDK software in c:\jdk1.2beta4, the following commands will run the first Animator demo:

    cd c:\jdk1.2beta4\demo\applets\animator
    c:\jdk1.2beta4\bin\appletviewer example1.html
However, it makes more sense to add c:\jdk1.2beta4\bin\ to PATH so you only need to enter the tool names.

Setting Environment Variables

There are three ways to set Windows environment variables:

Winsock Issues

JDK software no longer includes Microsoft Winsock 2.0. It is extremely likely that your system already has Winsock 2.0. Windows NT 4.0 and Windows 98 come with Winsock 2.0. Windows 95 comes with Winsock 1.2, but most Windows 95 systems have been upgraded to Winsock 2.0 by now.

Microsoft provides a free software bundle, the Microsoft Windows Sockets 2.0 Software Development Kit, that includes Winsock 2.0. Even if you don't need to upgrade your own system, you may want to obtain this kit so you can deploy network applications on Windows 95 systems. For more information, see Deploying Java Applications.

Possible Configuration Problems

JDK software is designed to work with the TCP/IP drivers included with Windows. Third-party drivers, such as Trumpet Winsock, are not supported. If you're using a third-party driver, and Appletviewer produces errors such as "net.socketException: errno = 10047" or "Unsupported version of Windows Socket API", you'll need to restore the native TCP/IP drivers.

Solaris

Running The Development Tools

After installing the JDK software, you start a tool by typing its name into a shell window with a filename as an argument. 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 startup file. For example, if the JDK software is installed at /usr/local/jdk1.2beta4 to run the complier on a file myfile.java, go to a shell and execute:

    /usr/local/jdk1.beta4/bin/javac myfile.java
or add /usr/local/jdk1.2beta4/bin to your PATH and type:
    javac myfile.java

Multithreading Issues

The Java platform is a multithreading environment. Solaris native methods that are not multithread safe (MT-safe) may not work correctly. Native methods usually need to be compiled with the option -D_REENTRANT and use reentrant versions of certain Solaris APIs. For more information, see the Multithreaded Programming Guide, part of the Solaris Software Developer AnswerBook in the Solaris 2.6 Software Developer Collection, Volume 1. A web version is available on docs.sun.com.

By default, JDK software uses a platform-independent multithreading model known as "green threads." On Solaris, you can use the multithreading model build into the Solaris kernel, known as "native threads." Native threads have the following advantages:

Changes in timing can unmask thread synchronization bugs. Your code may contain such a bug if it behaves differently under native threads than under green threads.

There are two ways to specify a threading model:

A threads command-line option takes precedence over the THREADS_FLAG value.

To use Solaris Native Threads, you need Solaris 2.5.1 or Solaris 2.6. Earlier versions of Solaris, including Solaris 2.5, are not supported.

To support Native Threads, Solaris 2.5.1 needs two patches which resolve thread synchronization problems. See "Solaris Patches," below

Solaris Patches

No patches are required for Solaris 2.6. If your development or target platform is Solaris 2.5.1, you should consider installing the following patches:

Solaris-SPARC Patch # Solaris-x86 Patch # Nature of Patch Problems Without Patch
103566-08 104241-01 Xserver bug fixes Native Threads will not work correctly
103640-08 103641-08 Kernel bug fixes Native Threads will not work correctly
103641-13 104195-04 Motif bug fixes AWT text peers may crash

The last two digits of the patch numbers indicate the patch version; you can use the indicated patch versions or later versions of the same patches. All of the above patches are included in the Solaris 2.5.1 Recommended Patch Cluster or the Solaris 2.5.1 x86_Recommended Patch Cluster.

To determine which patches are installed, use the shell command "showrev":

    % showrev -p
You can obtain patches from your warranty provider, from SunService (if you have a SunSpectrum contract) or from the SunSolve web site. To obtain the Patch Clusters from the SunSolve web site:
  1. Access the web site at sunsolve.sun.com.
  2. Choose the "Public Patches" link.
  3. Download either the Solaris 2.5.1 Recommended Patch Cluster or the Solaris 2.5.1 x86_Recommended Patch Cluster.
  4. Follow the instructions in the Patch Cluster README, available from the "Public Patches" page.