How to find the ClassLoader with a static method ?

P

Philippe Poulard

Hi,

I got a static method of a class that needs to retrieve the class loader
used for this class, but I don't have any instance of it.

I must -actually- have an instance of this class before to retrieve the
appropriate class loader.

Is it possible to retreive the class loader of a class that has no
instance yet ?
How should I do ?

Thanks.
Philippe Poulard
 
P

Philippe Poulard

Thomas said:
Assuming your class is called MyClass, then you can retrieve the
classloader using

MyClass.class.getClassLoader()

Thomas

Thanks, that's exactly what I need.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top