Classloader issue

Hi guys,

I have small test program in Java. When I run it by Sun's Java launcher, it shows both instances created and are the same (sun.misc.Launcher$AppClassLoader), the code:

System.out.println("this.getClass.getClassLoader = " + this.getClass().getClassLoader());

System.out.println("Thread.currentThread.getContextClassLoader = " +

Thread.currentThread().getContextClassLoader());

However, when I run it by my JNI interface (JVM startup, etc) getContextClassLoader() method returns null, while first method returns an sun.misc.Launcher$AppClassLoader instance.

What is that and why it is so ? (I have troubles because of that)

Thanks,

Alex.

[700 byte] By [Alex_55_1a] at [2007-11-26 15:57:07]
# 1
Guys,does anybody know abything about this problem ?Thanks,.Alex.
Schutzengela at 2007-7-8 22:17:59 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

Tested it on JDK 6.0. The result is:

this.getClass.getClassLoader = sun.misc.Launcher$AppClassLoader@35ce36

Thread.currentThread.getContextClassLoader = sun.misc.Launcher$AppClassLoader@35ce36

Hard to tell what is wrong with your test.

Maybe by showing some code we could help.

Regards

jfbrierea at 2007-7-8 22:17:59 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3
Thank you, Jean for replay.I tested it with java1.5 only, will retest with 1.6 but later.BTW, the code is so simple, there is only one constructor with given lines. No need to post it here. :)Just to be sure, did your test was via JNI from native C-program
Schutzengela at 2007-7-8 22:17:59 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 4
> Just to be sure, did your test was via JNI from native C-program ?Yes it is and it works fine.Maybe you should show us the relevant C code.Regards
jfbrierea at 2007-7-8 22:17:59 > top of Java-index,Java HotSpot Virtual Machine,Specifications...