4 Replies - 1706 Views - Last Post: 31 May 2012 - 03:51 PM Rate Topic: -----

#1 Cosine  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 31-May 12

Runnable .jar does not run (Eclipse)

Posted 31 May 2012 - 12:08 PM

I've written a simple program in Eclipse that takes in a few values and spits out a file. It has a GUI built with WindowBuilder. Everything works fine in Eclipse. I'm also able to create a .jar file using File>Export>Runnable .jar file. However, double-clicking this .jar file does show me anything.

Looking at Process Explorer, I found a javaw.exe running (parented by Eclipse). However, I noticed that whenever I try to run the .jar file, a javaw.exe (parented by explorer.exe) appears for a second, then disappears. This leads me to believe that a missing file is causing the program to crash on startup, since the program runs without a problem in Eclipse.

Is there any way to check which files might be missing, or get an error log?

Is This A Good Question/Topic? 0
  • +

Replies To: Runnable .jar does not run (Eclipse)

#2 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2814
  • View blog
  • Posts: 11,915
  • Joined: 20-September 08

Re: Runnable .jar does not run (Eclipse)

Posted 31 May 2012 - 12:10 PM

Run it from the command line

C:\Users\Cosine\>java -jar thejar.jar

Was This Post Helpful? 1
  • +
  • -

#3 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8343
  • View blog
  • Posts: 31,890
  • Joined: 06-March 08

Re: Runnable .jar does not run (Eclipse)

Posted 31 May 2012 - 12:53 PM

It is because your file association with .jar is not done.
When you right click on the .jar and "Open with" it should be
Jav ™ SE Binary
Was This Post Helpful? 0
  • +
  • -

#4 Cosine  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 31-May 12

Re: Runnable .jar does not run (Eclipse)

Posted 31 May 2012 - 02:25 PM

Alright, so that gave me an error log to go off of. I noticed it looked peculiarly like an error I had before. As it turns out, it was! I used this thread to get the program to run in Eclipse. To quote that thread:

Quote

Right click on project and go to Properties

In Java Build Path under the Projects tab there is the associated Project, in my case org.eclipse.swt.win32.win32.x86

Expand this down with the little arrow to the left to display the options. Here I found Native Library Locations. This wasn't set so I selected it and clicked Edit.

In the Popup window that follows, I selected Workspace and then org.eclipse.swt.win32.win32.x86.

Then I found this. I extracted the zip to the eclipse\plugins folder, and now it works.

Thanks for your help!
Was This Post Helpful? 0
  • +
  • -

#5 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2814
  • View blog
  • Posts: 11,915
  • Joined: 20-September 08

Re: Runnable .jar does not run (Eclipse)

Posted 31 May 2012 - 03:51 PM

Quote

Alright, so that gave me an error log to go off of. I noticed it looked peculiarly like an error I had before.


I can kind of guess what that error was, but it would have been good if you posted it. As long as you can run the jar now in the normal way (no unzipping of course) then that's OK
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1