Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes classloader inversion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "classloader inversion" Watch "classloader inversion" New topic
Author

classloader inversion

Paulo Jiang
Greenhorn

Joined: Oct 28, 2011
Posts: 1

Can anybody please explain the following paragraph from "core java volume II 8th edtion" Page 759


/////////////////////////////////

Your application code contains a helper method that calls Class.forName(classNameString).

That method is called from a plugin class.

The classNameString specifies a class that is contained in the plugin JAR.

The author of the plugin has the reasonable expectation that the class should be loaded. However, the helper method's class was loaded by the system class loader, and that is the class loader used by Class.forName. The classes in the plugin JAR are not visible. This phenomenon is called classloader inversion ......

////////////////////////////////


From my understanding, if "the helper method's class was loaded by the system class loader", then the plugin jar it is in must be placed in the CLASSPATH, and also if "The classNameString specifies a class that is contained in the plugin JAR" then these two classes should be both in the same jar file, which is in CLASSPATH, then why "The classes in the plugin JAR are not visible"

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: classloader inversion