Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Help with executing a jar file

Reply
Thread Tools

Help with executing a jar file

 
 
Bryan
Guest
Posts: n/a
 
      12-15-2006
Hello all,

I'm having trouble executing a jar file I created using Eclipse. I
have two projects set up in Eclipse... one with all the main source
code (no Main classes) and another with a main class that utilizes code
from the other project. I created a jar of the first project and added
the jar to the build path of the second project and I can run the Main
class in the second project no problem. I then created a jar file of
the second project and included the Main class in the manifest. When I
try to execute this jar file from the command line I get the following
error:

% java -cp SourceCode.jar -jar Executable.jar
Exception in thread "main" java.lang.NoClassDefFoundError:
/path/to/some/package/class

Both the source jar and the executable jar are in the current working
directory. Any clues as to why this isn't working?

Thanks!

 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      12-15-2006
Bryan wrote:
....
> % java -cp SourceCode.jar -jar Executable.jar


Note the -cp option is ignored when the -jar
option is specified.

Andrew T.

 
Reply With Quote
 
 
 
 
Bryan
Guest
Posts: n/a
 
      12-15-2006
So how do I tell it to include SourceCode.jar in the classpath so
Executable.jar has access to it?

On Dec 15, 11:22 am, "Andrew Thompson" <andrewtho...@gmail.com> wrote:
> Bryan wrote:...
>
> > % java -cp SourceCode.jar -jar Executable.jarNote the -cp option is ignored when the -jar

> option is specified.
>
> Andrew T.


 
Reply With Quote
 
Knute Johnson
Guest
Posts: n/a
 
      12-15-2006
Bryan wrote:
> So how do I tell it to include SourceCode.jar in the classpath so
> Executable.jar has access to it?
>
> On Dec 15, 11:22 am, "Andrew Thompson" <andrewtho...@gmail.com> wrote:
>> Bryan wrote:...
>>
>>> % java -cp SourceCode.jar -jar Executable.jarNote the -cp option is ignored when the -jar

>> option is specified.
>>
>> Andrew T.

>


You have to specify it in the manifest file.

http://rabbitbrush.frazmtn.com/classpath.html#jar

--

Knute Johnson
email s/nospam/knute/
 
Reply With Quote
 
Bryan
Guest
Posts: n/a
 
      12-15-2006
Thanks, that worked great!!

On Dec 15, 12:29 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
wrote:
> Bryan wrote:
> > So how do I tell it to include SourceCode.jar in the classpath so
> > Executable.jar has access to it?

>
> > On Dec 15, 11:22 am, "Andrew Thompson" <andrewtho...@gmail.com> wrote:
> >> Bryan wrote:...

>
> >>> % java -cp SourceCode.jar -jar Executable.jarNote the -cp option is ignored when the -jar
> >> option is specified.

>
> >> Andrew T.You have to specify it in the manifest file.

>
> http://rabbitbrush.frazmtn.com/classpath.html#jar
>
> --
>
> Knute Johnson
> email s/nospam/knute/


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing a static non-main operation in a jar file contained withina war file O.B. Java 0 06-24-2006 05:47 PM
java -cp a.jar -jar b.jar => Works on Windows, not on Debian cyberco Java 4 02-14-2006 06:27 AM
jaas.jar, jta.jar jdbc-stdext.jar missing from jdk1.5 RPM muttley Java 0 10-20-2005 02:40 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters Java 0 01-05-2005 10:59 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters XML 0 01-05-2005 10:59 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57