File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JNLP and Web Start and the fly likes jar not executing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "jar not executing" Watch "jar not executing" New topic

jar not executing

Darren Brooks
Ranch Hand

Joined: Dec 29, 2005
Posts: 32
When I double-click my .jar file, the windows hour glass happens for an instant, but then the application i created doesn't run. I don't know what the issue could be since I've gone through this process with my other apps, and each one of them runs when I 2x-click their jar files.

Following the instructions (i hope) in Head First Java (btw, Thank the authors for this book!), I created an executable JAR. I hit the return key at the end of my manifest.txt file, and created the jar from my classes dir, just like it says on page 592, and just like I've done before.

I get no error messages; the app just doesn't run. Any thoughts? thanks!
Mary Shell

Joined: Jan 15, 2003
Posts: 15

Try running it from the command prompt:
java -jar myjar.jar

It will actually show you the error it is having. Most likely it can't
find Main.

Darren Brooks
Ranch Hand

Joined: Dec 29, 2005
Posts: 32
Thank you! I realized the area of the problem when I ran the app from the command line, as you suggested. There were two things: I created some of my own utility packages which I forgot to copy into the application's directory structure, and I forgot to update one of the paths to a file to represent the this same directory tree I created when I put the app into a package.

many thanks!!!
Darren Brooks
Ranch Hand

Joined: Dec 29, 2005
Posts: 32
ok, now there's another file path issue I am confused about: my app reads a file when loading. I have the file located in the directory tree in the right place, so that when I 2x-click on the jar file (the .jar file located in the classes directory), the app is run.

However, when I move this .jar file to another directory, say, the desktop, the app does not run (because it cannot find the needed file).

I guess I could make the path like so - "c:\java\myApp\..." - but will this work if I send the jar to a friend? And what about the idea that when the jar file is created it includes everything under the com directory? And what about Naomi?

so strange to me...hope I explained my soap opera clearly enough.
I agree. Here's the link:
subject: jar not executing
It's not a secret anymore!