Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Advanced-java] Origin of a Class
- From: mgart@xxxxxxxxxxxxx (Gart, Mitch)
- Subject: [Advanced-java] Origin of a Class
- Date: Wed, 13 Mar 2002 15:17:10 -0500
object.getClass().getClassLoader() instanceof java.net.URLClassLoader
will tell you if it comes from a URLClassLoader. But after that I
don't know of a way to find out where it was loaded from.
System.getProperty("java.class.path") gets you the classpath.
- Mitch
> -----Original Message-----
> From: Mahesh [mailto:maheshg@xxxxxxxxx]
> Sent: Wednesday, March 13, 2002 3:07 PM
> To: advanced-java@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [Advanced-java] Origin of a Class
>
>
> 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
>
>
>
>
> _______________________________________________
> Advanced-java mailing list
> Advanced-java@xxxxxxxxxxxxxxxxxxxxxx
> http://lists.xcf.berkeley.edu/mailman/listinfo/advanced-java
>
- Prev by Date: [Advanced-java] Origin of a Class
- Next by Date: [Advanced-java] Origin of a Class
- Previous by thread: [Advanced-java] aliasing charsets
- Next by thread: [Advanced-java] jsp:include
- Index(es):