ext directory : Java Glossary

go to home page E words local find full screen, hide local find menu Google search web for more information on this topic jump to foot of page translate this page with Babelfish 2007-08-06 by Roedy Green ©1996-2008 Canadian Mind Products
index page for letter ⇒ punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all)
ext directory
Any jar included in JRE’s ext directory is searched for class files, automatically considered part of the classpath.
Introduction Downsides
Applets Links
Automating

Introduction

Simply copying or moving your jar files to the ext directory pointed to by the system property java.ext.dirs =C:\Program Files\java\jre1.6.0_07\lib\ext automatically puts them on the classpath without having to mention them explicitly. This is a great way to prune back an overblown classpath. It is safest to put your jars in all the ext directories:
where to look for ext directories :
You never know for sure where your javac.exe or java.exe is going to look. Grrr. You can change the location of the ext directory on the command line.
java.exe -Djava.ext.dirs=C:\mylibs mypackage.MyClass

ext dir with Applets

With Applets you normally arrange to preinstall any large jar files. Then you are stuck with the problem of where to them and how to you arrange to get them on the classpath. You can use Java Web Start or you can scatter them and have the user configure a custom classpath or you can use the ext directory. Sometimes you will have so many jar files, you can’t fit them all on the classpath. What you can do then is look at the system property,
System.getProperty( "java.ext.dirs" );
which you can view by running wassup as an application or Applet. Then put the jar in the corresponding directory. e.g.
java.ext.dirs = C:\Program Files\Java\jre1.6.0_07\lib\ext
Any jars jars in the ext directory will automatically be found without putting them on the classpath.

There are at least two ext directories:

where additional jars on the path are kept :
java.exe uses the JRE version and where javac.exe uses the debugging JDK version.

Automating

Sooner or later you will have to reinstall the JDK/JRE and you will lose your ext directories. You can quickly rebuild them if you maintain a bat file like this and run it after every JRE/JDK install. Adjust the file to account for where your ext dirs are and where the jars are you need.

Downsides

The main problems with the extdir technique are:

CMP homejump to top
CMP logo
feedback Please email your feedback for publication, errors, omissions, broken/redirected link reports
and suggestions to improve this page to Roedy Green : feedback email
made with CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[65.110.21.43]
Your face IP:[38.103.63.59] The information on this page is for non-military use only.
You are visitor number 4,574. Military use includes use by defence contractors.
You can get a fresh copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/ext.html J:\mindprod\jgloss\ext.html