The Java Developer's Kit

Are you an absolute beginner? Here's a brief introduction to using the JDK.

Java has taken the Internet and programming communities by storm during the past year with its promise to enable the creation of software that can run on any platform from a single binary file and be used securely in a distributed network environment.

The Java concept is simple: a single source code file is compiled to a single pseudo-binary file containing Java byte codes. This binary file can be run on any platform for which a Java interpreter or other runtime engine exists.

In order to develop and test these Java applications, it is necessary to have access to several critical development tools, including a compiler, a debugger and a Java interpreter for testing applications. Numerous Java development environments already exist—primarily for MS-Windows systems. These full professional development tools are produced by the likes of Borland and Symantec. For Linux, and Unix in general, this type of commercial development tool hasn't become available.

Nonetheless, this doesn't mean that Linux users are unable to develop Java applets and applications. Sun Microsystems has developed a free Java Developer's Kit (JDK) which includes a compiler, a debugger, a runtime environment and an applet viewer for testing Java applets embedded in web pages.

Obtaining the JDK

The Java Developer's Kit was originally developed by Sun for SPARC, Solaris and Windows NT/95. These versions of the kit, along with more recent versions for x86 Solaris and MacOS, are available from the JavaSoft web site at

Sun has also allowed other organizations to port the JDK to other platforms. The Blackdown Organization (Randy Chapman) has ported version 1.0.1 of the JDK to Linux and makes binaries available for x86 versions of Linux. The JDK distribution for Linux is available from Blackdown also has a web page at On the web site you will find three files:


It is necessary to download two of these three files:


plus either:




The last file requires an ELF binary of version 2.0 of the Motif libraries ( If you don't have Motif, download linux.jdk-1.0.1-try3.static-motif-bin.tar.gz instead—it is a larger file but will work regardless of whether you have the Motif libraries or not. Throughout this article we will be using linux.jdk-1.0.1-try3.static-motif-bin.tar.gz.

All versions of the Java Developer's Kit also require the following libraries, many of which may already be on your system:

  • /lib/

  • /usr/X11/lib/

  • /usr/X11/lib/

  • /usr/X11/lib/

  • /usr/X11/lib/

  • /lib/

If you are missing any of these libraries, the JDK will not work. These libraries are all freely available on the Internet.

Installing the JDK

Once the “common” tar file and one of the Motif tars have been downloaded, they need to be uncompressed. The documentation with the Linux JDK recommends installing the JDK in the /usr/local directory (although it can be installed elsewhere). To do this, copy the two compressed tar files to /usr/local with:

cp linux.jdk-1.0.1-try3.common.tar.gz /usr/local

Then, the files can be uncompressed and untarred with:

tar xzvf linux.jdk-1.0.1-try3.common.tar.gz

This will create a directory java/ under /usr/local which contains four subdirectories: bin, demo, include and lib. /usr/local/java will also contain a zip file with the source and various README and HOWTO files. The bin/ directory contains the scripts used to execute all the components of the JDK. The components are:

  • appletviewer: A viewer to test applets embedded in HTML documents.

  • javac: The Java compiler: compiles Java source code to Java byte code binary files (known as class files). The class files produced by javac can be run by a Java interpreter on any platform.

  • java: The Java interpreter: used to execute Java class files under Linux.

  • jdb: The Java Debugger: a command-line debugger which is in alpha development.

Each of these scripts in java/bin actually call executable files in java/bin/i586. These scripts expect certain tools to exist in fixed locations in your system. Specifically, the appletviewer script expects mkdir to be in /usr/bin and pwd to be in /bin. On some systems, this may not be true (for instance, in RedHat-derived systems, you may find mkdir in /bin). There are two solutions to this problem. One is to edit java/bin/appletviewer and replace the incorrect occurrences of /usr/bin/mkdir or /bin/pwd with the correct full paths of these programs.

The second solution is to create symbolic links in the directories expected by appletviewer. For instance, on RedHat systems where mkdir is in /bin, a symbolic link could be created in /usr/bin with the command:

ln -s /bin/mkdir /usr/bin/mkdir

If you expect to be using the JDK components frequently, you will probably want to add the java/bin directory to your path. Assuming you installed the JDK under /usr/local and you are running the bash shell (the default shell for many Linux distributions), you could add the following lines to the .bashrc file in your home directory:

export PATH

If you are running C shell, the following line at the end of your .cshrc file in your home directory will do the job:

setenv PATH /usr/local/java/bin:$PATH

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState