Forum Stats

  • 3,769,582 Users
  • 2,252,983 Discussions


Deploying Runnable JAR Files

jdevmt999 Member Posts: 19
edited Jan 21, 2015 1:55PM in Java 8 Questions

I recently started working with Java 8.  I have been doing Java development on and off since the early 1990's.  Most recently I have been doing all my current work in Java 6.  I decided to "take the plunge" and to start getting involved with Java 8.  I have an imaging application for geologic research I started working on in Java 6 and Swing, and I am now continuing that development under Java 8.  It was a pleasant surprise that to find that all of my code built without any changes (I'm using Eclipse Luna and just deleted the Java 6 runtime and added the Java 8 runtime after downloading it).  The application launches fine from inside Eclipse.

However I ran into a problem when exporting the application from Eclipse to a runnable JAR file and then trying to launch it.  After creating the runnable JAR I was not able to launch it by simply double clicking.  A command line box would open for a second, then close and the application window would never open.  To upgrade from Java 6 to Java 8 I only downloaded the Java 8 runtime environment, not the Java 8 JDK.  I am working in Windows 7 and tried updating the JAR file associations and experimented with various path entries in my environment variables.  No mater what I did I could not simply double click the runnable JAR to launch it.

Then I deleted all my Java downloads and started over.  This time all I did was downloaded the Java 8 JDK and installed it.  I then pointed Eclipse to the Java 8 runtime environment that was installed with the Java 8 JDK.  My code built and executed perfectly in the Eclipse environment.  Then I exported the the Eclipse project as a runnable JAR again and tried to launch it.  This time it worked as expected.  Double clicking the runnable JAR launched the application!

So my question is if I want to give this application to someone to run (i.e. deploy it) that is not a developer, do I have to have them install the Java 8 JDK?  I assumed that all someone would need to run the application as a runnable JAR is the Java 8 runtime environment, not the JDK.  However, when I had only the Java 8 runtime environment installed I could not launch the runnable JAR.  With the Java 8 JDK I was able to run the runnable JAR as expected, with no problem.

Am I missing something?