Content deleted Content added
Add information and in-line citations |
m →JAR hell: punctuation |
||
(12 intermediate revisions by 10 users not shown) | |||
Line 1:
The '''Java
|last1=Mcmanis |first1=Chuck
|date=1996-10-01 |df=mdy
Line 32:
|url=http://www.ibm.com/developerworks/java/library/j-dyn0429/
|title=Classes and class loading
|work=
|accessdate=2008-01-26
}}</ref>{{sfn | Horstmann | 2022 | loc=§10.1.1 The Class-Loading Process}}
Line 39:
# System class loader
The bootstrap class loader loads the core Java libraries<ref group=fn>These libraries are stored in [[JAR (file format)|Jar files]] called ''rt.jar'', ''core.jar'', ''server.jar'', etc.</ref> located in the <code><JAVA_HOME>/jre/lib</code> (or <code><JAVA_HOME>/jmods></code> for Java 9 and above) directory. This class loader, which is part of the core JVM, is written in native code. The
The extensions class loader loads the code in the extensions directories (<code><JAVA_HOME>/jre/lib/ext</code>,<ref name="TJT:UECL"/> or any other directory specified
Line 47:
==User-defined class loaders==
The Java class loader is written in Java. It is therefore possible to create
This makes it possible (for example):
Line 65:
* to modify the loaded bytecode (for example, for load-time [[aspect weaver|weaving]] of aspects when using [[aspect-oriented programming]]).
== Class
[[Jakarta EE]] (formerly Java EE and J2EE) application servers typically load classes from a deployed [[WAR (file format)|WAR]] or [[EAR (file format)|EAR]] archive by a tree of class loaders, isolating the application from other applications, but sharing classes between deployed modules. So-called "[[servlet container]]s" are typically implemented in terms of multiple class loaders.<ref name="Christudas"/><ref>{{cite web
|last1=deBoer |first1=Tim
Line 72:
|url=https://www.ibm.com/developerworks/websphere/library/techarticles/0112_deboer/deboer.html
|title=J2EE Class Loading Demystified
|work=
|accessdate=2008-01-26
}}</ref>
Line 84:
The [[OSGi]] Alliance specified (starting as JSR 8 in 1998) a modularity framework that aims to solve JAR hell for current and future VMs in ME, SE, and EE that is widely adopted. Using metadata in the JAR [[manifest file|manifest]], JAR files (called bundles) are wired on a per-package basis. Bundles can export packages, import packages and keep packages private, providing the basic constructs of modularity and versioned dependency management.
▲}}</ref> which was included in [[Java version history#Java SE 9|Java 9]]. Released in 2017, it includes support for modular software, termed "Java Platform Module System", which is controlled on source level with module-info.java files. It follows a different philosophy from the OSGi architecture that aims at providing modularity for the Java Runtime Environment in a backwards-compatible way that uses the default mechanism of loading classes that the JRE provides. However, since it does not offer the ability for controlled co-existence of libraries with different versions, it is not suited for tackling the JAR Hell problem.<ref>{{cite web|first1=Neil|last1=Bartlett|first2=Kai|last2=Hackbarth|title=Java 9, OSGi and the Future of Modularity (Part 1)
|url=https://www.infoq.com/articles/java9-osgi-future-modularity/#1|publisher=InfoQ|date=2016-09-22}}</ref>
Line 118 ⟶ 104:
* Chuck McManis, "[https://www.infoworld.com/article/2077260/learn-java-the-basics-of-java-class-loaders.html The basics of Java class loaders]", 1996
* Brandon E. Taylor, "[http://www.developer.com/java/other/article.php/2248831 Java Class Loading: The Basics] {{Webarchive|url=https://web.archive.org/web/20201109091535/http://www.developer.com/java/other/article.php/2248831 |date=2020-11-09 }}", 2003
* Jeff Hanson, "[http://www.devx.com/Java/Article/31614 Take Control of Class Loading in Java] {{Webarchive|url=https://web.archive.org/web/20201204030013/http://www.devx.com/Java/Article/31614 |date=2020-12-04 }}", 2006-06-01
* Andreas Schaefer, "[https://web.archive.org/web/20180506212821/http://www.onjava.com/pub/a/onjava/2003/11/12/classloader.html Inside Class Loaders]", 2003-11-12
|