| Plug-in runtime classpath - How does it work? [message #266960] | 
Tue, 09 December 2008 01:40   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hey, 
 
In the PDE Plug-in Manifest Editor, I can specify the classpath for my  
plug-in (the list at the bottom right, titled 'classpath'). 
 
Just to test this, I ad a random external library, say 'library.jar' to  
it, which is in the 'libs' folder of my plugin. Now I export the plugin  
into a single jar with the export wizard. The exported jar contains the  
library.jar in the libs folder. 
 
 
The manifest contains : 
Bundle-ClassPath: lib/com.playw.toolbox.jar, 
  lib/library.jar 
 
What I am now curious about is how classes in the library.jar get  
resolved during runtime. 
 
This seems just kind of magic.. Does the eclipse runtime rely on a  
custom classloader that searches the nested jars when required? 
 
 
Thankx for explaining. 
Felix
 |  
 |  
  | 
| Re: Plug-in runtime classpath - How does it work? [message #266966 is a reply to message #266960] | 
Tue, 09 December 2008 06:07    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Felix, 
 
When Eclipse detects this case that you have jars within jars (nested  
jars) it will unzip the jar into the local file system (once and cache  
it) so that the nested jars can be put on the classpath.   As such, it's  
not a great idea to nest jars in jarred plugins.  It's better to put  
them in a different plugin that isn't jarred. 
 
 
Felix Dorner wrote: 
> Hey, 
> 
> In the PDE Plug-in Manifest Editor, I can specify the classpath for my  
> plug-in (the list at the bottom right, titled 'classpath'). 
> 
> Just to test this, I ad a random external library, say 'library.jar'  
> to it, which is in the 'libs' folder of my plugin. Now I export the  
> plugin into a single jar with the export wizard. The exported jar  
> contains the library.jar in the libs folder. 
> 
> 
> The manifest contains : 
> Bundle-ClassPath: lib/com.playw.toolbox.jar, 
>  lib/library.jar 
> 
> What I am now curious about is how classes in the library.jar get  
> resolved during runtime. 
> 
> This seems just kind of magic.. Does the eclipse runtime rely on a  
> custom classloader that searches the nested jars when required? 
> 
> 
> Thankx for explaining. 
> Felix
 |  
 |  
  | 
| Re: Plug-in runtime classpath - How does it work? [message #266972 is a reply to message #266966] | 
Tue, 09 December 2008 08:38   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hey Ed, 
 
thanks a lot for the explanation. Actually asking if there's a way to  
not jar the plugin would have been my next question. I simply unchecked 
the "Package plug-ins as individual jar archives" option in the Export  
Wizard. Nice. 
 
Felix 
 
> When Eclipse detects this case that you have jars within jars (nested  
> jars) it will unzip the jar into the local file system (once and cache  
> it) so that the nested jars can be put on the classpath.   As such, it's  
> not a great idea to nest jars in jarred plugins.  It's better to put  
> them in a different plugin that isn't jarred.
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.08555 seconds