...class loader of a class, executing new...

2009/8/5, Pavel Pervov <pmcfi...@gmail.com>:
> Hello, Tian.
> Thread context classloader is not used on new opcode. The initiating
> class loader of ClassType will be the class loader, which executes new
> instead. The defining loader will depend on the class being loaded and
> VM setup.
>
> 2009/8/5, galaxy <tian.gal...@gmail.com>:
>> Hi all
>> I have a question about the jre classloader .
>> In my work of jre osgi , I have to implement a new classloader to load
>> the
>> classes since the
>> classloading mechanism is very different from the default one .
>> So I am thinking of the
>> Thread.currentThread().setContextClassloader(myclassloader),
>> but this is not very useful.
>> for example [1] , the stdout will print systemclassloader or null depends
>> on
>> the class to load ..
>> So how to make sure that a " new ClassLoader " will use my classloader
>> instead of loading every one using myClassLoader.loadClass(String)
>>
>> [1]
>> Thread.currentThread().setContextClassloader(myclassloader),
>> ClassType object = new ClassType();
>> system.out.println(object.getClass().getClassLoader())
>>
>>
>>
>>
>> --
>> regards
>> Tian
>>
>

Reply via email to