[Qt-jambi-interest] Using non-standard classloader
Gregor Mückl
GregorMueckl at gmx.de
Thu Aug 27 02:37:12 CEST 2009
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
> Qt-jambi-interest at trolltech.com
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt.nokia.com/pipermail/qt-jambi-interest/attachments/20090827/a99764f4/attachment.bin
More information about the Qt-jambi-interest
mailing list