Classloader issue [message #554611] |
Mon, 23 August 2010 16:54 |
|
Hi,
I have a jar that I can't embed in a RCP application for license reasons.
I try several things and only one works but It implies to embed the jar.
What works:
- add the jar in the plugin, add it to the plugin classpath and export its packages
What give ClassNotFoundException:
- add "-bootclasspath" argument when launching the framework
- add "-classpath" argument when launching the framework
- try to do it programmatically
ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
ClassLoader classLoaderWithEndorsedLibs = new URLClassLoader(new URL[]{URLOfMyAddedJar} , currentClassLoader );
try {
Thread.currentThread().setContextClassLoader(classLoaderWithEndorsedLibs);
/*do my work which requires the jar*/
} catch(){...}finally{
Thread.currentThread().setContextClassLoader(currentClassLoader );
}
- add it in jre/lib/ext of the JVM
I'm using Eclipse 3.6.0 and sun jvm 1.6u20
Thanks for any hints.
Regards,
Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
[Updated on: Mon, 23 August 2010 16:54] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02007 seconds