Skip to main content



      Home
Home » Newcomers » Newcomers » Cannot find external jars in my jar file
Cannot find external jars in my jar file [message #246331] Tue, 22 January 2008 07:24 Go to next message
Eclipse UserFriend
Originally posted by: sandwichc.gmail.com

Dear all:
I added the external jars to Eclipse 3.3
I can get the correct result if I run the
program from Eclipse directly. (Ctrl+F11)

Now I want to export the whole project to
a jar file (From file --> export).

Double click on the generated jar file, would
get the following msg:
"Could not find the main class. Program will exit"

I tried to type
java -jar myFile.jar
from command line, and got
Exception in thread "main"
java.lang.NoClassDefFoundError: org/xxx/yyy/ZZZZ

org/xxx/yyy/ZZZZ is the 3rd party jars I imported

I tried to unzip myFile.jar and found that the
3rd party jars are included in the zip file.

Can anyone tell me what can I do to correctly
import the external jars in my case?

Thanks a lot in advance.
Re: Cannot find external jars in my jar file [message #246344 is a reply to message #246331] Tue, 22 January 2008 07:29 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Sean,

There was another post like this not long ago. Generally your exported
jar will only contain what's physically nested in the project. If you
run the application in the IDE under debug control and have a look in
the debug view at the running application, you can right click on the
application (the nested entry with the double gears) and use
"Properties..." to see the command line invocation used to run the
application. That's how you need to run your final application (though
with your exported jar).

Sean wrote:
> Dear all:
> I added the external jars to Eclipse 3.3
> I can get the correct result if I run the
> program from Eclipse directly. (Ctrl+F11)
>
> Now I want to export the whole project to a jar file (From file -->
> export).
>
> Double click on the generated jar file, would
> get the following msg:
> "Could not find the main class. Program will exit"
>
> I tried to type
> java -jar myFile.jar
> from command line, and got
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/xxx/yyy/ZZZZ
>
> org/xxx/yyy/ZZZZ is the 3rd party jars I imported
>
> I tried to unzip myFile.jar and found that the
> 3rd party jars are included in the zip file.
>
> Can anyone tell me what can I do to correctly
> import the external jars in my case?
>
> Thanks a lot in advance.
>
Previous Topic:ClassNotFoundError
Next Topic:content assist not available
Goto Forum:
  


Current Time: Thu May 22 10:24:50 EDT 2025

Powered by FUDForum. Page generated in 0.08134 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top