🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.language
2 messages
2 total messages Started by Alvin Randolph Tue, 28 Aug 2007 10:19
Why Doesn't This Jar File Work
#122
Author: Alvin Randolph
Date: Tue, 28 Aug 2007 10:19
24 lines
1556 bytes
When I run PrintFields in that package examples, JBuilder6 sets 1st 
classpath to outpath and executes examples.PrintFields. I replicated 
this on the command line

java -cp outpath examples.PrintFields

Then I created jar file printfds.jar containing PrintFields.class,

jar cvfm printfds.jar manifest.txt PrintFields.class

& set main class in manifest file with

Main-Class: examples.PrintFields

When I ran jar file,

java -cp outpath -jar examples.printfds.jar

I got message,
Exception in class "main" java.Lang.NoClassDefFoundError: 
examples/PrintFields.
What am I doing wrong???
-- 
Alvin Randolph 
Re: Why Doesn't This Jar File Work
#123
Author: Gillmer J. Derge [TeamB]
Date: Tue, 28 Aug 2007 14:04
29 lines
2053 bytes
Alvin Randolph wrote:
> When I run PrintFields in that package examples, JBuilder6 sets 1st 
> classpath to outpath and executes examples.PrintFields. I replicated 
> this on the command line
> 
> java -cp outpath examples.PrintFields
> 
> Then I created jar file printfds.jar containing PrintFields.class,
> 
> jar cvfm printfds.jar manifest.txt PrintFields.class

It looks like you're creating this JAR file from the wrong directory. 
The file needs to contain examples/PrintFields.class.  You're running 
the command from within the outpath directory so it contains 
PrintFields.class without the examples/ directory prefix.

You should run it from one level up.  Something like:

   jar cvfm printfds.jar examples/manifest.txt examples/PrintFields.class

More generally, you'll probably have better luck if you move 
manifest.txt out of outpath and then just include everything in outpath 
(to avoid missing important classes as your application grows and you 
forget to change the JAR command).

   jar cvfm printfds.jar manifest.txt examples

-- 
Gillmer J. Derge [TeamB]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads