Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exported runnable JAR file from Eclipse doesn't seem to execute

(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 :-)

like image 560
Chris Haines Avatar asked Sep 08 '10 15:09

Chris Haines


People also ask

Why are my jar files not executing?

If you can't run jar files on your Windows 10 PC, you might need to reinstall Java Runtime Environment. When JAR files are not opening, another great method is to simply use a universal file opener. Alternatively, some reported that turning your JAR file into a BAT file worked perfectly.

How do I run a runnable jar in Eclipse?

In Eclipse, select File → Export, then Java → Runnable JAR File. Launch Configuration identifies which program should be exported. Find the one that runs the class containing your main() method. Export Destination is the name and location of the JAR file you want to generate.

How do I run an exported JAR file?

Select Java > Runnable JAR file as the export destination and click Next. On the next page, specify the name and path of the JAR file to create and select the Launch configuration that includes the project name and the name of the test class.


1 Answers

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.

like image 129
Stroboskop Avatar answered Nov 10 '22 09:11

Stroboskop