On Wednesday 26 August 2009, Helge Fredriksen wrote:
> Hello!
>
> Is it possible to use a proprietary class loader with QtJambi?
>
> Regards,
> Helge F.
> _______________________________________________
> Qt-jambi-interest mailing list
> [email protected]
> http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Hi!

As far as I understand the issues that I had, it would be possible to use Qt 
Jambi with proprietary classloaders if Qt Jambi could actually resolve all 
classes that are derived from QObject. So the trick is to make Qt jambi use a 
ClassLoader with a classpath that contains all QObject derived classes.

The code to obtain a reference to a ClassLoader inside Qt Jambi is 
quite complex and I am not completely sure if I traced it correctly. But it 
seems to me that  Qt Jambi goes straight to a new instance of 
java.lang.ClassLoader for its queries, which actually acts as a simple 
forwarder to the system-wide classloader that is used at application startup.

Now, if you look at the documentation for ClassLoader#getSystemClassLoader() 
in the JDK reference, you will find that you can make the runtime use a non-
standard classloader if you set the property java.system.class.loader right at 
startup. So this is a mechanism that would allow you slip in your custom 
ClassLoader, but at a cost: virtually every other ClassLoader ends up 
forwarding its requests to this one, if it can't resolve them itself.

I'm not sure if I overlooked something in the Qt Jambi code, though. Still, I 
hope that this helps.

Regards,
Gregor

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to