(追記) (追記ここまで)

ext directory : Java Glossary

home page go to the Java Glossary Home go to the Computer Buyer’s Glossary up jump to foot of page Google search web for more information on this topic Pinterest pin button
*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)
©1996-2017 2007年08月06日 Roedy Green of Canadian Mind Products

ext directory
Any jar included in JRE (Java Runtime Environment) ’s ext directory is searched for class files, automatically considered part of the classpath. menu

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.8.0_131\ \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
java.exe -Djava.ext.dirs=C:\mylibs mypackage.MyClass

As of Java version 1.6, you can have as many ext dirs as you want and you can put them wherever you please. You must tell Java where to look for them by setting the java system property java.ext.dirs.

To find out which ext dir java.exe is loading from, use the -verbose:class command line option to dump out the source of each class as it is loaded.

To my surprise, I caught java loading classes from the ext directory in preference to the copies in the application jar.

Visibility

Ext Visibility
Ext Dir Visibility
JRE ext Browser ext JDK (Java Development Kit) ext Purpose
Compiling (finding method signatures to generate correct code to call methods).
running applications from local hard disk.
running Applets from local hard disk.
running Applets from the web.
running Java Web Start applications from local hard disk.
running Java Web Start applications from the web.

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
java.ext.dirs = C:\Program Files\Java\jre1.8.0_131\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.

Mac OS (Operating System) X

I don’t have a Mac myself, so I cannot verify this information’s current accuracy. Mac OS X PowerPC computers support up to to Java version 1.5. The Intel versions support up to 1.6, but only 64-bit. Macs have four ext directories:
  1. ~/Library/Java/Extensions (for this user only) (may have to be manually created).
  2. /Library/Java/Extensions (system wide).
  3. /System/Library/Java/Extensions
  4. /System/Library/Frameworks/JavaVM.framework/Versions/ 1.8.0 /Home/lib/ext
You should probably use (1) or (2) for your own additions.

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:
  • You can’t deal with two versions of the same jar. With classpath, you can select one or the other version as the need arises.
  • There are two different ext directories per JVM (Java Virtual Machine) installed. You need to propagate your jars to all of them. Often you forget when you upgrade your JVM.

Learning More

Oracle’s Miscellaneous documentation on ext mechanism
Oracle’s Java 1.8 documentation on : ext mechanism


standard footer
CMP home jump to top

This page is posted
on the web at:

http://mindprod.com/jgloss/ext.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\ext.html
Canadian Mind Products
Please read the feedback from other visitors, or send your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.
Canadian Mind Products
IP:[65.110.21.43]
Your face IP:[40.74.122.252]
(追記) (追記ここまで)
Feedback You are visitor number
website statistics
[フレーム]

AltStyle によって変換されたページ (->オリジナル) /