Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Bundle.findEntries doesn't find files when deployed as jar
Bundle.findEntries doesn't find files when deployed as jar [message #790115] Fri, 03 February 2012 21:01 Go to next message
Hendrik Renken is currently offline Hendrik RenkenFriend
Messages: 18
Registered: July 2009
Junior Member
Hi there,

I'm trying to deploy our self made development platform as a Java-Library consisting of a bunch of jars. Therefore i created a new plugin, added two extensions to org.eclipse.jdt.core and org.eclipse.jdt.ui for Classpath-Entry specification and so far that works fine.

Now the plugin contains our custom code as jars in a directory called 'lib' .
Now i want to reference those files in my ClasspathEntry. To find the .jars (their actual name changes when the jars are updated) i'm using Bundle#findEntries(".", "*.jar", true)

In development mode this works fine, but after deployment through a p2-update site, findEntries won't find anything (null is returned). So far, i don't know if it happens to be the permissions that i do not have (but i can't find anything that related to that) or if findEntries can't find the jars because they are contained in the deployed jar.

Could someone push me into the right direction where to look for a solution? It's very cumbersome to debug this because the error only shows up in a production environment.

Regards
Hendrik

[Updated on: Fri, 03 February 2012 21:32]

Report message to a moderator

Re: Bundle.findEntries doesn't find Entries when plugin is deployed [message #790131 is a reply to message #790115] Fri, 03 February 2012 21:32 Go to previous messageGo to next message
Hendrik Renken is currently offline Hendrik RenkenFriend
Messages: 18
Registered: July 2009
Junior Member
After consulting the method Bundle.hasPermission() it turns out, that the bundle has the permission to call Bundle.findEntries(). I more or less expected this, since i couldn't find any reference to permissions in my eclipse and java installation.
So this means, Bundle.findEntries is not capable of finding files inside the bundle.jar.

That leads me to my question: How can i deploy a plugin as a directory? I tried several options using the export wizard but that didn't work. Maybe i can try to resolve the files through a manipulation of the Path element. I'll try that tomorrow. Maybe someone comes up with a better solution?
Re: Bundle.findEntries doesn't find files when deployed as jar [message #790148 is a reply to message #790115] Fri, 03 February 2012 22:08 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 501
Registered: July 2009
Senior Member
Quote:
Now the plugin contains our custom code as jars in a directory called 'lib' .
Now i want to reference those files in my ClasspathEntry. To find the .jars (their actual name changes when the jars are updated) i'm using Bundle#findEntries(".", "*.jar", true)


I think you should use "/" as the base path to search in. The "." likely works in development mode because your bundle is be loaded from a project (directory) and the use of File allows for '.' to be used. In production it sounds like your bundles are jar'ed bundles and the use of ZipFile is not finding '.' as the root.

The javadoc for findEntries states: A path value of "/" indicates the root of this bundle.
Re: Bundle.findEntries doesn't find files when deployed as jar [message #790158 is a reply to message #790148] Fri, 03 February 2012 22:25 Go to previous messageGo to next message
Hendrik Renken is currently offline Hendrik RenkenFriend
Messages: 18
Registered: July 2009
Junior Member
Yeah. Also found that out a couple of minutes ago. Anyway thanks for the response.

At the end i ended up, at the point, that i did have urls of the form jar:file:/Eclipse/plugin.jar!/lib/myjar.jar - after clipping jar:file: from the url (the path has to be absolute to be a classpathentry) i can add my library as an classpathentry but the jars cannot be resolved, because they are inside a jar.

Now i'm extracting my jars into a temporary directory and reference them from there. That works quite fine and i'm able to update the jars now and then when i deploy a new version of the plugin.

[Updated on: Fri, 03 February 2012 22:26]

Report message to a moderator

Re: Bundle.findEntries doesn't find files when deployed as jar [message #791857 is a reply to message #790158] Mon, 06 February 2012 10:38 Go to previous message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 482
Registered: December 2010
Location: Germany
Senior Member
Hello

this might help: Using
Eclipse-BundleShape: dir

in your MANIFEST.MF will make Eclipse export the plugin as a directory (and not as a jar file). You can then access the files in the file sytem.

Greetings
Christoph
Previous Topic:[DS] create component with non-default constructor
Next Topic:Dynamically extendable Equinox application
Goto Forum:
  


Current Time: Sun Oct 17 19:32:02 GMT 2021

Powered by FUDForum. Page generated in 0.01917 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top