6

(Disclaimer: I am not a Java programmer, and really have very little idea what I'm doing in Eclipse)

I hacked out an application in Eclipse a while back which I finished off and exported as a JAR which runs nicely. I didn't take any notes or make any comments.

The time comes to make some changes to the project but I have to reload it all again because my PC has since been wiped so some settings etc have probably changed.

Anyway it all works and runs nicely from Eclipse. But when I export as a runnable JAR, and double click to run the application, it doesn't seem to execute.

I can see that there is an instance of javaw running, but no window appears. No errors. Nada.

As I said, it works beautifully in Eclipse. Any ideas?

I have little idea of how I can detect what is going on - as I said, I am NOT a java programmer :-)

Chris Haines
  • 6,445
  • 5
  • 49
  • 62
  • 2
    If your Java installation is registered for the .jar extension it will try to run the Jar (i guess that's what's happening). But it will do so quietly. In order to *see* what's happening (errors and such) you should try to run it from the command line with `java -jar myfile.jar`. – Stroboskop Sep 08 '10 at 15:50
  • If you look at the exported jar in Winrar (or any other compression program) does the manifest file (META-INF/MANIFEST.MF) reference your Main-Class? – Sean Sep 08 '10 at 15:50
  • Brilliant thanks Stroboskop - I was able to see there was an image it was trying to reference that wasn't included in the actual project so wasn't being packaged into the JAR. I'd like to be able to mark as answer but you didn't post as an answer :-) – Chris Haines Sep 08 '10 at 16:19
  • 1
    Actually i was just expecting to get a more precise error message from you to then post an answer to. But hey, you're more of a Java programmer than you admit. – Stroboskop Sep 08 '10 at 17:10

1 Answers1

7

Ok then, so you can mark the question closed:

If your Java installation is registered for the .jar extension it will try to run the Jar (i guess that's what's happening). But it will do so quietly.

In order to see what's happening (errors and such) you should try to run it from the command line with java -jar myfile.jar.

Stroboskop
  • 4,327
  • 5
  • 35
  • 52