gg cowra

Greenhorn
+ Follow
since Oct 03, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by gg cowra

Somprakash Rai wrote:Boot Strap class loader or default class loader which is defined in side JVM By default Boot Strap class loader will load your class. But boot strap class loader will load class from local file system.Also you can define you own class loader.
please correct me if I am wrong.



According to the delegation principle of Java classloaders' hierarchy, the bootstrap classloader will be delegated to try to load my classes, but it could not find them, because it only loads the classes in the JRE/lib or as specified by the command line switch -Xbootclasspath . By default my classes will be eventually loaded by System-Classpath classloader or some children of it.

The key of my problem is the visibility principle of classloader operation. The fact that classes written by myself can access standard JDK classes just because the bootstrap classloader is a parent classloader above the system-classpath classloader.
8 years ago

Ramon Anger wrote:Hi,

this works because classloaders inside a JVM build a hierarchy.

See http://www.objectsource.com/j2eechapters/Ch21-ClassLoaders_and_J2EE.htm or http://www.digilife.be/quickreferences/PT/Understanding%20the%20Java%20ClassLoader.pdf (especially the "further reading" section at page 17)

Regards,
Ramon



From the hyperlinks you provided, I got some valuable knowledge that I had never known.

Sing highly praise for your great help!
8 years ago
I am really confused by the classloader hierarchy. for example, a very simple AAA.java file:


When I run the AAA, it is absolutely loaded by system classloader, but the String.class, System.class and Integer.class referenced by it should be loaded by bootstrap classloader. So, class AAA and those it referenced are loaded by different classloaders. why AAA can access them ?
8 years ago