where did the images go in my jar-file?

Y

Yam

When I run my application from inside JCreator everything looks good. But
when I run the same application from a JAR-file, none of the pictures (gif)
shows.
Any clue?
Yam
 
A

Andrew Thompson

When I run my application from inside JCreator everything looks good. But
when I run the same application from a JAR-file, none of the pictures (gif)
shows.
Any clue?

Many. Which ones do you want?

Dump the IDE, it is slowing you down.
<http://www.xdweb.net/~dibblego/java/faq/answers.html#Q34>

Post to a group better suited to beginners.
<http://www.physci.org/codes/javafaq.jsp#cljh>

Check the exceptions that are thrown
<http://www.physci.org/codes/javafaq.jsp#exact>

...assuming you (or JCreator) is not swallowing them.
<http://www.physci.org/codes/javafaq.jsp#cljh>

For loading resources generally.
<http://www.physci.org/codes/javafaq.jsp#path>

HTH
 
J

jfalt

I believe that if you have the image inside your jar file, you have to
use the getResourceAsStream method to retrieve it.
 
M

Morten Alver

I believe that if you have the image inside your jar file, you have to
use the getResourceAsStream method to retrieve it.

I don't know about that method, but if you're using
javax.swing.ImageIcon, you can use getResource("/path/to/image") to
get an URL which you pass to ImageIcon's constructor. Remember the
initial "/" in the file name.
 
M

Morten Alver

When I run my application from inside JCreator everything looks good. But
when I run the same application from a JAR-file, none of the pictures (gif)
shows.
Any clue?

On the command line, "jar tf filename.jar" lists the contents of the
jar, so you can see where they are.
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top