Forums Register Login

Running a jar file

+Pie Number of slices to send: Send
Hi,

I have written some java program in which i am using some external jars. The code is running fine. I exported the jar as Runnable jar using the eclipse export option. I named the jar as abc.jar then i try to run it using "java -jar abc.jar". It started to execute but threw a exception java.lang.NoClassDefFoundError in between where i used the classes in the external jar, eventhough the refered jar files are there in classpath. Looks like classpath is getting reset to the current directory. I hope i am clear. Can anyone please help me resolve this issue.

Thanks in Advance
+Pie Number of slices to send: Send
+Pie Number of slices to send: Send
Please copy and paste full text of error message here.
To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'

Paste here.
+Pie Number of slices to send: Send
Hi Norm Radder,

I resolved the issue. Those external jars actually referring to some other jar. I think those jars where in the classpath thats why it was working when i run it from eclipse toolkit. But when i export my project as Runnable jar the manifest file will have an entry for classpath which points only to the current directory. So at run time my program wont find those additional jars. SO i also added those additional jars in my build path. That resolved the issue

Thanks,
Divith
I carry this gun in case a vending machine doesn't give me my fritos. This gun and this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1310 times.
Similar Threads
Java Environment Setup Problem - OS X 10.4.3, Java 1.5.0 - Running from Terminal
Exporting to jar file in eclipse
Unable To Run Jar File... Urgent....
Creating JARs & Classpath Issues
Loading resource from different jar on classpath
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 05:05:09.