Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JARS and Manifest files

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to do something like this:

This should work for you.
HTH,
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You , Thank You, Thank You!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic