I can launch the java appln by double click on the jar file, but the images does not display.
Anyone can tell me what I should do, inorder to display the images from the jar file?
Can you show us the code for how you are trying to load up the images in your application? As a guess, sounds like you are trying to load them from a directory location, not from the jar file package structure via a classloader.
I have a main.class file and dinmaster.jpg. So to make the executable jar file I created the manifest.txt file containing Manifest-Version: 1.0 Main-Class: main
I typed the cmd >jar cmf manifest.txt myproj.jar main.class dinmaster.jpg
So, I expect when i double click myproj.jar, the project launch. Yes it did, but then there are no images display at all. My image is set to local path sth like this : dinmasterLbl=new JLabel(); dinmasterLbl.setIcon(new ImageIcon("dinmaster.jpg"));
I hope u can understand my questions.........thanks
Joined: Aug 18, 2004
Originally posted by Hydra Iris:
Show what code? dinmasterLbl=new JLabel(); dinmasterLbl.setIcon(new ImageIcon("dinmaster.jpg"));
This is what I wanted. You can't do this when the image is stored in the jar file itself.
This works when the file is out in the file system somewhere, but not in the jar file. This is expecting to file the .jpg file in the current home directory of the application jar file (where-ever you double click the jar file from).
You need to do this instead to load it from the application jar file package structure:
Obviously reference the image from the correct place within your jar file. You will need to do this where ever you are trying to load up images.
Joined: Jun 21, 2006
Yes is working now. All images can be displayed as expected. I'm so happy......Thank You )
Actually there is the prolem that where are you keeping the images,when u are making the executable jar file binding all files and folder like manifest,images,class files etc. You must have to keep the image files in that directory where you are keepng your main project folder otherwise u can give the full path of the images where actually u are keeping the images. I think now you will be able to see the images when u will execute the jar file.