Problem with getting resource path

Joined
Jan 10, 2009
Messages
1
Reaction score
0
hi, in my application (a JFrame, not Applet) I want to load images stored in the project into the app. Using Toolkit.getDefaultToolkit().getImage("a.jpg"); works fine in my own box, but when I compile it, the images aren´t shown. I've tried
java.net.URL imageURL = MyClass.class.getClassLoader().getResource("1b.jpg"); but the images are still not shown...my idea is getting the jar with all the images ( I also have some MP3· and XML files) and show them from there. So far , when I run the .jar, it searchs for the images relatively from the folder I'm running it (that's why they're not shown), but my idea is for it to look for the images, MP3·, XML inside the compiled jar.
Thanx in advance
 

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

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top