jar problem: everything works fine, except for a .jpg file
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   basundhara_mohanty
Posted On:   Sunday, April 9, 2006 06:54 AM

This is my first attempt at creating a jar file I created a jar file this way, - first created the Manifest.txt file and added the the main class, follwed steps from the tutorial at sun: http://java.sun.com/docs/books/tutorial/deployment/jar/appman.html then this at command prompt jar cfm Aid.jar Manifest.txt IDTT/ Now when i run the jar file every thing runs fine except for the About.jpg, that file doesn't show up when i click the about button in the application Everything works fine when i directly run the file from command prompt as java IDTT/Aid Error recieved: Exception in thread    More>>


This is my first attempt at creating a jar file



I created a jar file this way,

- first created the Manifest.txt file and added the the main class,
follwed steps from the tutorial at sun:
http://java.sun.com/docs/books/tutorial/deployment/jar/appman.html



then this at command prompt

jar cfm Aid.jar Manifest.txt IDTT/



Now when i run the jar file every thing runs fine except for the About.jpg,
that file doesn't show up when i click the about button in the application



Everything works fine when i directly run the file from command prompt as java IDTT/Aid



Error recieved:

Exception in thread "AWT-EventQueue-0"
java.lang.NullPointerException

at javax.swing.ImageIcon. (Unknown Source)

at IDTT.Aid$AboutPanel. (Aid.java:336)

at IDTT.Aid.menuItem_AboutActionPerformed
(Aid.java:304)

...
..



this is line 336 in Aid.java:

javax.swing.ImageIcon aboutimage = new javax.swing.ImageIcon(getClass().getResource("resources/"+"About.jpg"));



Aid.java has package as

package IDTT,



the files in folder graph


have package as

package IDTT.graph



"resources" is a normal folder that has a image file called
About.jpg

and another folder called "html" that contains many html files.

there's no error for html files



This is the package/folder tree structure


			
IDTT
|
|- Aid.java (has main)
|
|- graph (a package that Aid.java uses)
|
|_ resources
|
|- About.jpg
|
|- html


   <<Less

Re: jar problem: everything works fine, except for a .jpg file

Posted By:   basundhara_mohanty  
Posted On:   Monday, April 10, 2006 01:29 AM

got the solution

aboutimage = new javax.swing.ImageIcon(getClass().getResource("resources/image/"+"About.JPG"));

just changed the case of extension .jpg to .JPG
About | Sitemap | Contact