Java 2 Software Development Kit

The Java 2 SDK is mow available for Linux. Mr. Foxwell tells us all about it.

Since its introduction four years ago, Sun's Java technology has appeared on nearly every size and type of computer system, from IBM's MVS-powered mainframes to 3Com's Palm organizers.

New versions of the Java Development Kit and Java Virtual Machine are available first on Sun's systems and on Microsoft Windows, but many months may pass before they appear on other platforms. Sun's Java Software division produces reference implementations only for Solaris and for Windows, and licenses source code to other system vendors who want to port the JDK or JVM to their own hardware and operating systems.

Some vendors, like IBM, have their ports of new Java versions ready almost immediately. Unfortunately, users of platforms such as Apple's Macintosh have had long waits for the latest JDK. Linux users didn't see JDK 1.1 until mid-1997, although Sun introduced it in December 1996, and they have been eagerly awaiting Java 2 since November of last year.

Sun had no problem figuring out with whom to arrange Java licensing agreements at the major system vendors, but it did take them a while to identify a licensee for the widely dispersed Linux community. They eventually licensed the JDK source code to Steve Byrne and the Blackdown Java-Linux Porting Team, a group of Linux developers.

The Blackdown team recently released a preliminary version of the Java 2 SDK aft er testing it extensively with the Java Compatibility Kit, a suite of more than 16,000 tests which verify a port's conformance to the published Java language and runtime specifications.

You can download the Java 2 SDK for Linux from the Blackdown mirror web sites, found at http://www.blackdown.org/. Note that Sun recently changed the name of the software from JDK 1.2 to Java 2 SDK, although much of the on-line material still refers to the earlier name. The compressed SDK is nearly 24MB, so use a fast network connection if possible. Full documentation for Java 2 is packaged separately from the SDK. Download it directly from Sun's web site at java.sun.com/products/jdk/1.2/docs/index.html.

Installation and Testing

Installation consists of uncompressing and extracting the jdk1.2pre-v2.tar.bz2 file archive into your home directory or other location. Use the command:

bzip2 -d jdk1.2pre-v2.tar.bz2
tar xvf jdk1.2pre-v2.tar

In order to use the JDK, you must have a Linux distribution that includes the glibc2 version of the GNU C library. Most distributions, such as Red Hat 5.2, include this library, which is also called libc6.

After installation, simply set your PATH environment variable to include the JDK's bin directory, and you're ready to go:

export PATH={JDK-install-directory}/jdk1.2/bin:$PATH

To verify your installation, type:

java -version
The JVM should run and report its version as “java version 1.2”, along with additional information about the implementation.

The Java 2 SDK includes several tools for development and testing, including the javac compiler, the jar Java archive manager that works similarly to the tar command, and the appletviewer program for testing applets. “Applets” are Java programs intended to run within a browser; Java “applications” are like any other program and don't need a browser to run. Current versions of Netscape and Internet Explorer do not directly support Java 2, so you will need to use appletviewer to test your applets.

The Java 2 SDK comes with a compiler, but does not include an interactive development environment. You can, of course, use vi or emacs to create your source files, then compile and run them from your command line. For example, create the file HelloLinux.java containing the lines:

public class HelloLinux
   { public static void main(String[] args)
      { System.out.println("Hello, Linux!"); } }

Compile your program with the command javac HelloLinux.java. The compiler will produce the file HelloLinux.class, which you run using the command java HelloLinux. If you encounter problems trying to compile and run Java programs, check your PATH and CLASSPATH environment variables. CLASSPATH lists the directories where the JVM looks for class files. If your own files or the class files required for a separately installed Java library are not referenced in CLASSPATH, the JVM cannot find and run them.

______________________

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix