![]() |
|
[Java] [SOLVED] Program runs properly in IDE but not as jar - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Java] [SOLVED] Program runs properly in IDE but not as jar (/showthread.php?tid=5069300) |
[SOLVED] Program runs properly in IDE but not as jar - Bacnezumha The Purger - Nov 24, 2015 Typically my java programs are either for personal use or for school so I always just run them in eclipse. The program I am currently working on I plan to release here on HF so I decided to figure out how to export it to a jar... first time doing so. When I run my program in eclipse everything works as it should. When I run the exported jar the program doesn't work properly. It goes through the first few steps of main and then ends. --> Yes the jar is associated properly, it runs. --> Main is set in the manifest. --> No exceptions are thrown. --> Consists of a main, 1 class, 4 images, and a bunch of imported java classes. --> From various tests through command prompt it seems the issue lies either with the images or with the second class. So what can be the problem here I'm pretty stumped and I've seen a lot of people with this problem online and none have a solution for me. * - +Haze - Nov 24, 2015 I've had this issue before, the issue is due to how resources are located in debug mode in an IDE when compared to running the jar outside the IDE. How do you reference your paths? Try adding a prepending "/" before the string location. Works for it. Or try prepending "file:" I've never really understood why the error occured, but trial and error helped me fix it. Anyway, show the part of your code you're having issues with. * - MrOrang - Nov 24, 2015 Are you sure you export any libraries into the jar and put in all other resources? |