Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2005

Tip: Looking for answers? Try searching our database.

Relative jar URL

Thread view: 
Philippe Poulard - 16 May 2005 16:40 GMT
hi,

i want to refer to a resource stored in the jar files found in the classpath
usually, jar must wrap a full url, specified with scheme+path :
jar:file:///path/to/my.jar!/path/to/my/resource

any tip to remove the reference to my.jar ?
(i just need to store somewhere "jar:/path/to/my/resource" and tell a
loader to retrieve it)

or do i have to write my own loader that performs the lookup ?

Signature

Cordialement,

           ///
          (. .)
 -----ooO--(_)--Ooo-----

|   Philippe Poulard    |
 -----------------------
Michael Rauscher - 17 May 2005 06:26 GMT
Philippe Poulard schrieb:
> hi,
>
> i want to refer to a resource stored in the jar files found in the
> classpath

Have a look at Class#getResource and ClassLoader#getResource.

Bye
Michael
Philippe Poulard - 17 May 2005 08:20 GMT
> Philippe Poulard schrieb:
>
[quoted text clipped - 7 lines]
> Bye
> Michael

hi,

I already have used this classes.

I just want to know whether there is a syntax for jar URLs that allow to
load a resource without specifying the location of the jar file, or not

When I parse an URL with "jar:myJar!/path/to/resource" it fails

So the solution is to parse with an URI, check if the scheme is opaque
and equal to "jar" and use Class#getResource and ClassLoader#getResource
to do the job

Signature

Cordialement,

           ///
          (. .)
 -----ooO--(_)--Ooo-----

|   Philippe Poulard    |
 -----------------------


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.