Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Java in General and the fly likes Jar drive me crazy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Jar drive me crazy" Watch "Jar drive me crazy" New topic

Jar drive me crazy

Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

Hi all
I have the following dir:
dir\com // dir for class files
dir\images // dir for images
I have tried the following command:
jar cfv MyJar.jar com/*.class images/*.gif
jar cvmf MANIFEST MyJar.jar com/*.class images/*.gif
(this manifest includes the Main-Class property with "com.Manager value")
and the jar is runnable and no problem..
and now when trying these commands, the jar dosen't include the images !!
then I have changed the command to
jar cvmf manifest MyJar.jar com images
its include the images but its not runnable (I have extracted the jar and the manifest it all right and every thing is as I want)
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33117

Are you on UNIX/LINUX? If so, could it be because manifest is lowercase in the second example?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

I am using Windows XP.
I am always used the first two commands and they always work very well.
today, I want to package my application , and I faced this problem...
Maarten Vergouwen
Ranch Hand

Joined: Jan 12, 2004
Posts: 60
Are you running the JAR from inside an IDE?
If so, you might experience different behaviour when running it outside the IDE, since some IDEs (like NetBeans) have their own path settings which they apply.
Hence, when you run it from the IDE it works fine, and when you run it outside it suddenly cant find all of the files (or viceversa).
Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

I have alwayes used command limes to package my applications.
after downloading netbeans, I am unable to use the first two commands (unable means, they don't work)
(please note, I am not creating my jar using netbeans, and trying to run it using it)
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Jar drive me crazy too, but it was all going down hill after the Ewoks.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: Jar drive me crazy
It's not a secret anymore!