Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » class.getClassLoader().getResource is not working(class.getClassLoader().getResource is not working while trying to get file list from a jar file in using eclipse plugin)
class.getClassLoader().getResource is not working [message #698807] Wed, 20 July 2011 09:00 Go to next message
swastika is currently offline swastikaFriend
Messages: 1
Registered: July 2011
Junior Member
Hi,

We wrote an eclipse plugin in which need to get list of files from a jar file

to get the list of the files present we are using the following way

URL propertiesURL = MyClass.class.getClassLoader().getResource(
"resourcename");

But the propertiesURL doesnt return the correct path. Is there any other alternative available for this? Any input will be very much helpful to us.

Thanks.
Re: class.getClassLoader().getResource is not working [message #699217 is a reply to message #698807] Thu, 21 July 2011 05:48 Go to previous message
Adam Lucarz is currently offline Adam LucarzFriend
Messages: 518
Registered: July 2009
Senior Member
Hi,

in a bundle/plug-in context you have to use Activator.getDefault().getBundle().getEntry("resourcename") to get the right url. But be careful because the url is different concerning if the bundle is jarred or not.

By the way: Resources from within a jar are copied temporary to the active workspace. That is the target location which will be returned by the method mentioned above.

Greetings
Adam
Previous Topic:org.w3c.dom.Node method calls returning null values
Next Topic:Error while exporting product: host fragment not found
Goto Forum:
  


Current Time: Fri Apr 26 17:06:03 GMT 2024

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

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

Back to the top