Include JRE in my Jar for Swing app [duplicate]

2019-05-10 03:48发布

问题:

Possible Duplicate:
How to deliver my Java application with a particular JRE?

I have developed Java desktop application in Swing and created jar for that. This is working fine by double click on it, in my OS (Windows). Now I want to run same jar file in some other system (Different Operating system), that don't have any Java related software.

How to include JRE in my Java application that will make my application to run in any operating system?

回答1:

Include JRE by in my Jar

Don't do that. It is not only quirky and difficult, but would require at least 3 JREs in every application Jar (one each for Windows, OS X & *nix). That is a huge chunk of wasted download for people who only ever need one JRE.

Instead:

  1. Check the user has a suitable JRE using deployJava.js.
  2. Launch the app. using Java Web Start.