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

Jar file doesn't work

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. I have created a jar file and put a shortcut on my desktop so I can just click on it and run it. However, when I double click the shortcut, it acts like it's going to work, but then the hourglass goes away and nothing ever comes up. No errors either. Can someone please tell me what's going on??
Thanks!
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I changed javaw.exe to java.exe, and briefly got a DOS prompt that told me I had a null pointer exception. Which brings up another question. I am getting the NullPointerException on an Image. Why can't it find the image? It's in the jar file along with everything else, so why can't it see it??
 
Marilyn de Queiroz
Sheriff
Posts: 9063
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you run the jar file from the command line, the errors that are generated won't disappear. After you have it working, you can change it to a shortcut.
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. The application runs just fine from the command line. I just can't seem to get it to run from a jar file. It can't seem to find the image in the jar file, but it's in there. Is there something I missed?
 
Marilyn de Queiroz
Sheriff
Posts: 9063
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you run

java -jar MyApp.jar

from the command line?
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just realized what you meant after I posted the last time. Sorry. When I try to run the jar file from the command line, It says it failed to load the main-class from the manifest file.
 
Marilyn de Queiroz
Sheriff
Posts: 9063
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a manifest.mf file in your jar?
[ February 14, 2003: Message edited by: Marilyn de Queiroz ]
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup. Any other ideas?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic