Getting a reference to the current executed jar

When bundling my whole application into a executable jar , i can get images but not sound files... i use the ClassLoader.getSystemResource() for most items.. but ".wav" and possible overs wont load. These wavs are in the executed jar. What is a better way i could get a reference to them, and also to the executed jar file itself (for manual extraction).

[361 byte] By [primalpsyche] at [2007-9-30 23:08:50]
# 1
> What is a better way i could get a reference to themClass#getResource()Class#getResourceAsStream()
yawmark at 2007-7-7 13:41:41 > top of Java-index,Java Essentials,Java Programming...
# 2
TryInputStream is = ThisClass.class.getClassLoader().getResourceAsStream(resourceName);Note this will get a different classloader which uses the whole class-path.
Peter-Lawrey at 2007-7-7 13:41:41 > top of Java-index,Java Essentials,Java Programming...
# 3

> Try

> InputStream is =

> ThisClass.class.getClassLoader().getResourceAsStream(resourceName);

> Note this will get a different classloader which uses

> the whole class-path.

Just as an FYI, class.getResourceAsStream() delegates to the object's ClassLoader, so you can save some typing by omitting the call to getClassLoader(). :o)

yawmark at 2007-7-7 13:41:41 > top of Java-index,Java Essentials,Java Programming...