Java 2 SDK 1.2.2 Win32 Installation Notes

Installation Notes

JAVA 2 SDK, Standard Edition, Version 1.2.2_009 for Windows

Windows 95 / 98 / 2000 / NT 4.0 (Intel)

<version number>

jdk-1_2_2_<version number>-win.exe

jdk-1_2_2_008-win.exe

The win32 installer has been updated with the official product name of:

  • Java 2 SDK, Standard Edition, v 1.2.2_<version number>
  • Java 2 Runtime Environment, v 1.2.2_<version number>
  1. There are still references to the old product names of "Java Development Kit" and "Java Runtime Environment" in the windows registry as well as in some of the dialog boxes. These names could not be simply changed without impacting something else.
  2. The Add/Remove Programs list displays: Java 2 SDK Standard Edition v1.2.2

    If you have 1.2 or 1.2.1 installed, they will remain in the Add/Remove Programs until you do an Uninstall. It is strongly suggested that users remove their old 1.2 and 1.2.1 installation before installing this version.

  3. The Java 2 Runtime Environment can also be installed as part of the Java 2 Standard Edition. Users who don't want to install this should deselect the "Java 2 Runtime Environment" component from the "Select Component" dialog box.

Microsoft Windows Installation Instructions

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

Note:

After the Java 2 SDK software has been installed in step 3, you will be asked to reboot your system, which completes the registry modifications needed to deinstall the Java 2 SDK later. To continue using these instructions after rebooting, either print them now or use your Web browser's history function to get back to this page and then continue here.

The installation procedure has the following steps:

If you have any difficulties, see the Troubleshooting section at the end of this document.

1. Check the download file size

If you saved the self-installing executable to disk without running it from the download page at the Java Software web site, check to see that you have the complete file.

Before you download the 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.

2. Run the Java 2 SDK installer, if not already run

The file jdk-1_2_2_<version number>-win.exe is the Java 2 SDK software installer. If you downloaded it instead of running it directly from the web site, double-click on the installer's icon in whatever directory you've installed it on your computer. Then follow the instructions the installer provides. When done with the installation, you can delete the download file to recover disk space.

Note: - If you already installed the documentation bundle, then the docs directory was created in a location similar to c:\jdk1.2.2\docs. In that case, make sure you install the Java 2 SDK at c:\jdk1.2.2, so as to create the directory structure shown below. This step ensures that all of the SDK software's HTML links work properly.

On Windows 98: - The installer will sometimes hang on Windows 98 if you choose a location to install the Runtime Environment that is different from the default directory suggested by the installer. If this happens to you, re-run the installer and accept the default installation location that it suggests.

Installed Directory Tree
After installing both the Java 2 SDK software and documentation, the 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           |    |          __|__
 |  README                  | include      |     |
README.html           include-old         bin   lib

                  

3. Delete the downloaded file(s)

If you want to recover disk space, delete the file (or files) you originally downloaded.

4. Update the PATH variable

You can run the Java 2 SDK software 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 conveniently run the SDK executables ( javac.exe, java.exe, javadoc.exe, 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:


    C:>  
               \jdk1.2.2\bin\javac MyClass.java
            

It's useful to set the PATH permanently so it will persist after rebooting.

How do I set the PATH permanently?

To set the PATH permanently, add the full path of the jdk1.2.2\bin directory to the PATH variable. Typically this full path looks something like C:\jdk1.2.2\bin. Set the PATH as follows, according to whether you are on Windows NT or Windows 95/98.

Windows NT - To set the PATH permanently:

  1. Start the Control Panel, select System, select Environment, and look for "Path" in the User Variables and System Variables. If you're not sure where to add the path, add it to the right end of the "Path" in the User Variables. A typical value for PATH is:

    C:\jdk1.2.2\bin

    Capitalization doesn't matter. Click "Set", "OK" or "Apply".

    The PATH can be a series of directories separated by semi-colons (;). Microsoft Windows looks for programs in the PATH directories in order, from left to right. You should only have one bin directory for the Java 2 SDK in the path at a time (those following the first are ignored), so if one is already present, you can update it to 1.2.2.

  2. The new path takes effect in each new Command Prompt window you open after setting the PATH variable.

Windows 98 and Windows 95 - To set the PATH permanently, open the AUTOEXEC.BAT file and add or change the PATH statement as follows:

  1. Start the system editor. Choose "Start", "Run" and enter sysedit, then click OK. The system editor starts up with several windows showing. Go to the window that is displaying AUTOEXEC.BAT.
  2. Look for the PATH statement. (If you don't have one, add one.) If you're not sure where to add the path, add it to the right end of the PATH. For example, in the following PATH statement, we have added the bin directory at the right end:
    
                       
    PATH C:\WINDOWS;C:\WINDOWS\COMMAND
                         ;C:\JDK1.2.2\BIN 
                      
                    

    Capitalization doesn't matter. The PATH can be a series of directories separated by semi-colons (;). Microsoft Windows searches for programs in the PATH directories in order, from left to right. You should only have one bin directory for the Java 2 SDK in the path at a time (those following the first are ignored), so if one is already present, you can update it to 1.2.2.

  3. To make the path take effect in the current Command Prompt window, execute the following:
    
          C:>  
                       c:\autoexec.bat
                    

    To find out the current value of your PATH, to see if it took effect, at the command prompt, type:

    
          C:>  
                       path
                    

5. Check the CLASSPATH variable

The CLASSPATH variable is one way to tell applications written in the Java programming language (including the SDK tools) where to look for user classes. (The -classpath command-line switch is the preferred way.) If your machine does not have the CLASSPATH variable set, you can ignore the rest of this step. To check this, run the set command from the DOS prompt:


  C:>  
               set
            
         

If CLASSPATH does not appear in the list of settings, it is not set. If your CLASSPATH variable is set to some value, 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 software, as long as it contains the current directory " .". However, if your CLASSPATH contains classes.zip (which was only in JDK 1.0.x and JDK 1.1.x), and you don't plan to continue using those earlier versions, you can remove that setting from the CLASSPATH now. In any case, if CLASSPATH is set, it should include the current directory -- this makes it possible to compile and then run classes in the current directory.

How do I modify the CLASSPATH?

Use the same procedure you used for the PATH variable in the previous step and either:

  • Remove the CLASSPATH environment variable entirely.

    With Java 2 SDK, the default value is " .", the current directory. To include any user classes, use the -classpath command line switch instead with java, javac, javadoc and other tools. This is the recommended approach because it doesn't force one CLASSPATH for all applications.

    -OR-

  • If you have applications that require CLASSPATH be set, keep those required user classes in CLASSPATH and include the current directory " ." If you're no longer using JDK 1.1.x, remove classes.zip.

6. Start using the Java 2 SDK tools!

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 into the Command Prompt window, 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.exe, will not do anything useful. To get started, open the DOS Prompt window (on 95 or 98) or Command Prompt window (on NT) if you haven't already done so.

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 C:\jdk1.2.2 and you have set the path variable. (If you have not, add "C:\jdk1.2.2\bin" ahead of the javac and appletviewer commands.)

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


       C:>  
               javac HelloWorld.java
            
         

See the next section for a link to the Hello World examples, which include the source code for printing "Hello World".

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:
    
    C:>  
                       cd \jdk1.2.2\demo\applets\TicTacToe
                    
  • Run AppletViewer with the html file:
    
    C:>  
                       appletviewer example1.html
                    

    This example lets you interactively play Tic-Tac-Toe.

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

7. 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 also go to:

  • Hello World application and Hello World applet -- To write and compile a simple class, guided by the Java Tutorial.
  • Java Plug-in website -- If you installed this plug-in, both Internet Explorer and Netscape Navigator will use this plug-in when encountering HTML pages with special <OBJECT> and <EMBED> tags that invoke it. For details on how to configure your HTML pages, click the Java Plug-in website link above, then click "Documentation" and "Java Plug-In HTML Specification".

8. Uninstalling the Java 2 SDK

If you should ever want to uninstall the Java 2 SDK, go to the Start menu and select Settings, then select Control Panel. In the Control Panel, open the Add/Remove Programs utility. You will be presented with a list of software that you can uninstall. Simply choose the Java 2 SDK from the list and click the "Add/Remove..." button.

Troubleshooting the Installation

The following are tips for working around problems that are sometimes seen in a new installation.

  • If you see the following error message

    corrupt cabinet file

    then the file you have downloaded is corrupted. (A cabinet file contains compressed application, data, resource and DLL files.) Check its file size against the expected file size listed in these instructions. If they don't match, try downloading the bundle again.

  • If you see the following error message

    net.socketException: errno = 10047

    -or-

    Unsupported version of Windows Socket API

    check which TCP/IP drivers you have installed. The AppletViewer supports only the Microsoft TCP/IP drivers included with Windows 95. If you are using third-party drivers (e.g., Trumpet Winsock), you'll need to change over to the native Microsoft TCP/IP drivers if you want to load applets over the network.

  • If you see the following error message

    System Error during Decompression

    then you might not have enough space on the disk that contains your TEMP directory.

  • If you see the following error message

    This program cannot be run in DOS mode.

    then do the following:
    • Open the MS-DOS shell (Windows/Start/Programs/MS-DOS Prompt)
    • Right-click on the title bar
    • Select Properties
    • Choose the Program tab
    • Push the Advanced button
    • Make sure the item "Prevent MS-DOS-based programs from detecting Windows" is unchecked
    • Select OK
    • Select OK again
    • Exit the MS-DOS shell
    • Restart your computer.
  • If the AppletViewer does not load applets

    then you might try the following:

    1. set HOMEDRIVE=c:
      set HOMEPATH=\
      and restart the AppletViewer (in the same Command Prompt window)
    2. set HOME=c:\
      and restart the AppletViewer (in the same Command Prompt window)

    If none of these work, try:

    java -verbose sun.applet.AppletViewer

    This lists the classes that are being loaded. From this output, you can determine which class the AppletViewer is trying to load and where it's trying to load it from. Check to make sure that the class exists and is not corrupted in some way.

  • Appletviewer locks up

    This happens with NT Workstation 4.0, update 3, where the DISPLAY is configured for "true color". The appletviewer (and perhaps other entities) will lock up by running and then freezing the system consuming 100% CPU.

    To "test" this run the "java -verbose sun.applet.AppletView" and notice that it locks up when it tries to run the MTookit.class.

  • Winsock Issues

    The Java 2 SDK 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.1 or 1.2, but most Windows 95 systems have been upgraded to Winsock 2.0 by now.

    To check which version of Winsock you have, search for "winsock.dll". Then choose "Properties" from the File menu and click the Version tab.

    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.

  • Creating Source Files in Notepad - In Microsoft Windows, when you create a new file in Microsoft Notepad and then save it for the first time, Notepad normally adds the .txt extension to the filename. Therefore, a file you name Test.java is saved as Test.java.txt. It's important to note that you cannot see the .txt extension unless you turn on the viewing of file extensions (in Windows Explorer, uncheck "Hide file extensions for known file types" under Folder Options). To prevent the .txt extension, enclose the filename in quotation marks, such as "Test.java", when typing it into the Save As dialog box.

    On the other hand, Microsoft WordPad does not add a file extension if you provide one -- you must save the file as "Text Document".