Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Advanced-java] Origin of a Class


  • From: Mahesh" <maheshg@xxxxxxxxx (Mahesh)
  • Subject: [Advanced-java] Origin of a Class
  • Date: Wed, 13 Mar 2002 15:06:48 -0500

If given an instance of Object, is there a way to find out the URL from
which it was loaded ?

Object obj = new Object();
You can find the classloader for this object, from
obj.getClass().getClassLoader();
So i can find out whether it was loaded by the system classloader or
URLClassLoader or ...
Can you go further than this ? Is there a way to pinpoint the jar file from
which the class was loaded ?

Also is there a way to find out the "classpath" through JNI ?

thanks
Mahesh