-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
b18
JAR Index is a legacy optimization from early JDK releases to allow downloading of JAR files to be postponed when loading applets or other classes over the network. It is specified in the JAR file spec. JAR Index doesn't interact well with other features and has several long standing issues. Some examples:
- The JAR index file (META-INF/INDEX.LIST) is ignored in modular JARs.
- The JAR index is not reliable when be used with Multi-Release JAR files, e.g. when the versioned section has classes/resources in "new packages".
- URLClassLoader::findResources does not locate resources in more than one JAR file when a JAR index is present.
- JarInputStream::getManifest can not return the Manifest because the index is stored as the first entry in the JAR file.
We had hoped to deprecate or remove JAR Index in Java 9 but didn't get to it. In JDK 18, the support at runtime to ignore JAR index files by default with a system property to re-enable if needed. There has been no feedback on this change.
It is time to remove the JAR Index feature. Removing this feature means:
- Removing the JAR Index section from the JAR file spec or changing it document it as a historical feature.
- The jar -i (--generate-index=FILE) option can continue to generate the JAR index or the option can be changed to just emit a warning.
- The system property jdk.net.URLClassPath.enableJarIndex can be removed.
- The JAR index file (META-INF/INDEX.LIST) is ignored in modular JARs.
- The JAR index is not reliable when be used with Multi-Release JAR files, e.g. when the versioned section has classes/resources in "new packages".
- URLClassLoader::findResources does not locate resources in more than one JAR file when a JAR index is present.
- JarInputStream::getManifest can not return the Manifest because the index is stored as the first entry in the JAR file.
We had hoped to deprecate or remove JAR Index in Java 9 but didn't get to it. In JDK 18, the support at runtime to ignore JAR index files by default with a system property to re-enable if needed. There has been no feedback on this change.
It is time to remove the JAR Index feature. Removing this feature means:
- Removing the JAR Index section from the JAR file spec or changing it document it as a historical feature.
- The jar -i (--generate-index=FILE) option can continue to generate the JAR index or the option can be changed to just emit a warning.
- The system property jdk.net.URLClassPath.enableJarIndex can be removed.
- csr for
-
JDK-8305597 Remove JAR Index
- Closed
- duplicates
-
JDK-8263650 Re-examine JAR index support
- Closed
- relates to
-
JDK-8273401 Disable JarIndex Support In URLClassPath
- Resolved
-
JDK-6957241 ClassLoader.getResources() returns only 1 instance when using jar indexing
- Open
-
JDK-8305758 Update the JAR tool man page to indicate -i/--generate-file is deprecated
- Resolved
(2 links to)