Noel Enete
Get Java Binaries
NUGGET Jump Start


This is how to get the Java code and how to setup your environment. If you use the suggested directory names, the examples will work right out of the box and you will have access to several helpful tools.

Note: Since Java was first introduced, I have attempted to use the default names of the directories for the various Java products (JDK, JDBC, Jini, etc) hoping that a naming convention would take hold and help me organize my Java development directories. I guess the teams inside Sun are moving at such a rapid pace that there is no time to iron out this relatively minor issue (half a decade has elapsed and the conventions are still inconsistent and continue to change). So I decided to go with my own convention.

Directory Tree


My directory tree for Java development is:

    java/
      |
      +--java.102/
      |    |
      |    +--docs/
      |
      +--java.117/
      |    |
      |    +--docs/
      |
      +--java.120/
      |    |
      |    +--docs/
      |
      +--javanuggets/

Microsoft Windows


Create a base directory and expand Nuggets for Java into it:
  • Open a command line and create the following directory: \java.
  • If you haven't already done so, expand the javanuggets.zip file into this directory creating the \java\javanuggets directory.

Download the current version of Java 2:

  • Download the windows Java Developer Kit (JDK 1.2) big bundle (~20MB) and expand it into the \java directory.
  • Rename the directory from \java\jdk1.2.2 to \java\java.122 (use the command line ren command).
  • Download the JDK HTML documentation (JDK 1.2) big bundle (~16MB). It expands into the directory jdk1.2.2\docs. Copy the docs directory to java.122\docs then discard the original expansion.

Copy Tools into Path:

  • xcopy \java\javanuggets\tools4java.12x \java\java.122 /s
  • Makes available these commands (more info):
  • applet: generates skeleton applet (source)
  • application: generates skeleton application (source)
  • server: invokes a web server on current directory (source)
  • dump: tool to display hex dump of a file (source)
  • eol: converts file to PC, Mac, or Unix line endings (source)
  • sys: displays system properties object (source)
  • split: divides a file into floppy sized segments (source)
  • space: tool to report directory sizes (source)

Setup PATH:

  • Add an entry in your path for the directory \java\java.122\bin.
  • Or, if you are using several versions of Java, use the nugget scripts (in \java\javanuggets\scripts) to set the path as needed.
  • To use the nugget scripts:
    1. copy \java\javanuggets\scripts\*.bat \java
    2. Then, when you open a new command line, execute SetJavaPath12x.bat before using it and the path will be set. Or you can place one MSDOS icon on the desktop for every version of Java you have. Edit the properties of the icon and change the shortcut to execute the script. To do this on /NT the shortcut target would be: %SystemRoot%\system32\cmd.exe /K \java\SetJavaPath12x.bat
  • Here is the SetJavaPath12x.bat script file:
          @echo off
          set path=c:\java\java.122\bin;%path%
          prompt 1.22 $p$g

Red Hat Linux v. 6.0


Remove the Kaffe Java that comes with the distribution (Kaffe is not as mature as blackdown).

  • Logon to root.
  • From a command line, invoke GNU's package installer and uninstaller gnorpm
  • Under the Development section, open the Languages subsection.
  • Select the Kaffe package and uninstall it.

Create a base directory and expand Nuggets for Java into it:

  • Open a command line and create the following directory: ~/java.
  • If you haven't already done so, expand the javanuggets.zip file into it creating the ~/java/javanuggets directory.

Download the current version of blackdown's Java 2:

  • Download the Linux Java Developer Kit (JDK 1.2) from one of the mirror sites. Choose the i386 branch and the filename is jdk1.2pre-v2.tar.bz2 (~19MB).
  • After downloading the JDK, expand it with Linux's bunzip utility into the ~/java directory. If you need help with bunzip2, type bunzip --help. For more information about bzip2 check here.
  • After expanding the JDK, rename the directory to ~/java/java.120 (use mv).
  • Download the JDK HTML documentation (JDK 1.2) big bundle (~16MB) from Sun. It expands into the directory jdk1.2.0/docs. Copy the docs directory to ~/java.120/docs (you can use cp -R to do that) then discard the original expansion.

Copy Tools into Path:

  • cp -R ~/java/javanuggets/tools4java.12x/* ~/java/java.122
  • Makes available these commands (more info):
  • applet: generates skeleton applet (source)
  • application: generates skeleton application (source)
  • server: invokes a web server on current directory (source)
  • dump: tool to display hex dump of a file (source)
  • eol: converts file to PC, Mac, or Unix line endings (source)
  • sys: displays system properties object (source)
  • split: divides a file into floppy sized segments (source)
  • space: tool to report directory sizes (source)

Setup PATH and DISPLAY:

  • If you have not conditioned your DISPLAY variable for X yet, add the following line to your .bashrc or other logon script file: DISPLAY=:0.0
  • Add an entry in your path for the directory ~/java/java.120/bin.
  • Or, if you are using several versions of Java, use the scripts in ~/java/javanuggets/scripts. The 12 script, shown below, sets the path to include Java 120. I copy these scripts into my home directory: cp ~/java/javanuggets/scripts/1* ~. Also, use a dot (.) and a space on the command line before the name of the script so the path adjustments in the script apply to your current shell.
  • Also, in the script below, the dot (.) directory is added to the path as a personal preference for my java terminal sessions. It allows me to issue the command c rather than the command ./c to compile a java program.
    #!/bin/sh
    #
    #  Script in home directory called 12 
    #
    #  It sets a path to JDK 1.2  Use a 
    #  dot (.) to set the path in your 
    #  current shell:
    #
    #    . 12
    #
    PATH=~/java/java.120/bin:.:$PATH
    PS1="1.20 [\u@\h \W]\\$ "

Linux & Windows/NT Specifics


The examples in these nuggets were first developed using Windows/NT. Then I switched the OS of my primary development station from NT to Linux. Now, I do all my work under Linux (I just wanted to see if it was possible to do my work Gates-free). I have attempted to ensure that the examples would continue to work on either NT or Linux.



by Noel Enete . . . www.enete.com . . . noel@enete.com