Relative jar URL

P

Philippe Poulard

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 ?

--
Cordialement,

///
(. .)
-----ooO--(_)--Ooo-----
| Philippe Poulard |
-----------------------
 
M

Michael Rauscher

Philippe said:
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
 
P

Philippe Poulard

Michael said:
Have a look at Class#getResource and ClassLoader#getResource.

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

--
Cordialement,

///
(. .)
-----ooO--(_)--Ooo-----
| Philippe Poulard |
-----------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top