File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes JARS and Manifest files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JARS and Manifest files" Watch "JARS and Manifest files" New topic

JARS and Manifest files

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Hello. I have created a JAR file with some class files in it. Now I need to update the Manifest file to tell it the main class. I have tried running the following command:
jar umf mainInfo.txt OrderMainMenu.jar
The command works, but when I look at the manifest file it doesn't show that it entered it into the file. I am trying to run the application using a shortcut on the desktop and the Target is "c:\java\j2re1.4.0-rc\bin\javaw.exe -cp i:\VSK Java Programs\OrderMainMenu.jar"
What am I doing wrong?
Thanks for the help!!
[ February 21, 2002: Message edited by: Jennifer Sohl ]
Greg Brouelette
Ranch Hand

Joined: Jan 23, 2002
Posts: 144
Rather than updating with the "u" argument, I usually just re-build the entire jar.
I know there is a bug with the manifest file that requires there to be a newline after your main-class: line. That may be the problem.
Also, have you extracted the jar back into it's component files to see if the manifest does indeed have the main-class line in it?
These are at least a couple of things to try. Let us know how it works out.

For a good Prime, call:<br />29819592777931214269172453467810429868925511217482600306406141434158089
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Thanks for the reply! I did figure out that I needed to hit enter to make it find the main class. I can run it from my DOS prompt and it works. Now the only issue I am facing is trying to get it to run from a desktop shortcut. Right now, this is what my Target looks like:
C:\Java\j2re1.4.0-rc\bin\javaw.exe -cp c:\skjavaps\OrderMainMenu.jar
When I click on the shortcut, I don't get an error message, but I don't see my application either. I looked in task manager, and did not see it there either.
Am I doing this wrong?
Also, before I had my target pointing to a directory on our server and I received an error message- Couldn't find main class. But when it is on my C:\ it does what I explained above.
Could you help me out on this??
Thanks a lot! I REALLY appreciate it.
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Hi. Well, I figured out how to launch my application. I set my target with the following:
C:\Java\j2re1.4.0-rc\bin\javaw.exe -cp c:\skjavaps\OrderMainMenu.jar OrdEntMenu
It runs fine. I just have one problem. I have an ImageIcon on a JLabel on my application. It is not showing up on my app. I included this image in my jar file so I guess i assumed it would work. Maybe I coded it wrong. This is what I have:
label1.setIcon(new ImageIcon("Halloween.jpg"));
Is this correct? If so, why doesn't my image show up?
Thanks in advance.
Jason Kretzer
Ranch Hand

Joined: May 31, 2001
Posts: 280
You need to do something like this:

This should work for you.

Jason R. Kretzer<br />Software Engineer<br />System Administrator<br /><a href="" target="_blank" rel="nofollow"></a>
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Thank You , Thank You, Thank You!!!
I agree. Here's the link:
subject: JARS and Manifest files
It's not a secret anymore!