Skip to Main Content
Java Cookbook
book

Java Cookbook

by Ian F. Darwin
June 2001
Intermediate to advanced content levelIntermediate to advanced
888 pages
21h 1m
English
O'Reilly Media, Inc.
Content preview from Java Cookbook

Using Extensions or Other Packaged APIs

Problem

You have a JAR file of classes you want to use.

Solution

On JDK 1.2 or later, simply copy the JAR into JDKHOME/jre/lib/ext/.

Discussion

The Java API has grown by leaps and bounds since its first public release in 1995. It is now considered sufficiently functional for writing robust applications, but the areas to which it is being applied continue to grow. There are many specialized APIs that may require more resources than you have on a given Java platform. Many of the new APIs from Sun are in the form of standard extensions and have package names beginning in javax. to indicate that. Classes in packages named java. or javax. are treated as built-in classes by a web browser for purposes of applet security, for example. Each extension is distributed in the form of a JAR file (see Section 23.4).

If you have Java 1.1 or some clone, you will need to add each such JAR file to your CLASSPATH, as in Section 2.6.

In Java 2, as you accumulate these and other optional APIs contained in JAR files, you can simply drop these JAR files into the Java Extensions Mechanism directory, typically something like \jdk1.2\jre\lib\ext., instead of listing each JAR file in your CLASSPATH variable and watching CLASSPATH grow and grow and grow. Effective with Java 2, the runtime looks here for any and all JAR and zip files, so no special action is needed. In fact, unlike many other system changes, you do not even need to reboot your computer, since this directory ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical Cloud-Native Java Development with MicroProfile

Practical Cloud-Native Java Development with MicroProfile

Emily Jiang, Andrew McCright, John Alcorn, David Chan, Alasdair Nottingham
Distributed Computing in Java 9

Distributed Computing in Java 9

Raja Malleswara Rao Malleswara Rao Pattamsetti

Publisher Resources

ISBN: 0596001703Supplemental ContentCatalog PageErrata