I'm working on a Java program that uses icon files. The icons are stored in a folder "Icons" in \src. The code to access an icon is : image1 = new ImageIcon (Control.PrimaryGameFrame.class.getClassLoader().getResource ("Icons/openFile.gif")); The program runs properly in Eclipse but not the runnable
-
The program runs properly in Eclipse. But when I export its runnable jar to a folder "abc", then it needs the "Icons" folder to be present in "abc". If I place the jar alone at a place, it doesn't load the icons.What changes are to be made to the code, for the jar to find the icon files in itself & not in the folder it is in?
-
Answer:
put the jar in the CLASSPATH and then run the program again. set CLASSPATH=%CLASSPATH%;C:\work\runnable.jar Also for questions like these, you will get a better response on http://stackoverflow.com/
Vikash Kodati at Quora Visit the source
Related Q & A:
- I'm going on a disney cruise, what should I bring?Best solution by Yahoo! Answers
- I'm looking for a job but I'm only 16, where should I apply?Best solution by snagajob.com
- I'm looking for a summer job, any ideas?Best solution by employmentguide.com
- Pros and cos about this 3 cars.... My lease is about to end and I'm looking for a new car?Best solution by Yahoo! Answers
- I'm looking for a good BMX, any suggestions?Best solution by pinkbike.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.