Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Loading entry in a jar file(Loading entry in a jar file)
Loading entry in a jar file [message #535444] Sun, 23 May 2010 16:31 Go to next message
Ashwani Kr Sharma is currently offline Ashwani Kr SharmaFriend
Messages: 119
Registered: July 2009
Location: Bangalore, India
Senior Member

Hi,

I am trying to load an entry from inside a jar file.
e.g. from file:/c:/contents.jar!/com/demo/Test.employee

URI emfURI = URI.createURI(uri.toString());
Resource resource = mResourceFactory.createResource(uri, null);
resource.load(new HashMap<Object, Object>());


I was expecting this to work. But it fails saying FileNotFound.

I tried following value for uri:
1) uri = "jar:file:/c:/contents.jar!/com/demo/Test.employee"
2) uri = "file:/c:/contents.jar!/com/demo/Test.employee"

I can load using inputStream from jar for the jar entry but i expected above code to work.
Am i missing something ?

Thanks and Regards,
Ashwani Kr Sharma

Re: Loading entry in a jar file [message #535447 is a reply to message #535444] Sun, 23 May 2010 16:41 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Ashwani,

I'd expect 1) to work, but if you say it gets a FileNotFound exception
that makes me think that the jar isn't really at that location. You
could try "archive" instead of "jar", but I don't think that should make
a difference.


Ashwani Kr Sharma wrote:
> Hi,
>
> I am trying to load an entry from inside a jar file.
> e.g. from file:/c:/contents.jar!/com/demo/Test.employee
>
> URI emfURI = URI.createURI(uri.toString());
> Resource resource = mResourceFactory.createResource(uri, null);
> resource.load(new HashMap<Object, Object>());
>
> I was expecting this to work. But it fails saying FileNotFound.
>
> I tried following value for uri:
> 1) uri = "jar:file:/c:/contents.jar!/com/demo/Test.employee"
> 2) uri = "file:/c:/contents.jar!/com/demo/Test.employee"
>
> I can load using inputStream from jar for the jar entry but i expected
> above code to work. Am i missing something ?
>
> Thanks and Regards,
> Ashwani Kr Sharma
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Loading entry in a jar file [message #535484 is a reply to message #535447] Mon, 24 May 2010 02:30 Go to previous message
Ashwani Kr Sharma is currently offline Ashwani Kr SharmaFriend
Messages: 119
Registered: July 2009
Location: Bangalore, India
Senior Member

Hi Ed,

Yes, the option 1 worked. I was using a custom Resouce creator, which was not supporting loading from jar file, hence it failed.
Option 1 works.

Thanks for reply.

Regards,
Ashwani Kr Sharma
Previous Topic:[CDO] Installation conflict with Helios
Next Topic:generated NOT for class
Goto Forum:
  


Current Time: Thu Apr 25 04:34:30 GMT 2024

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

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

Back to the top