3

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?

Community
  • 1
  • 1
krish131
  • 163
  • 3
  • 14

1 Answers1

3

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.
Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • If the user required a specific version of Java I'd agree with this but he says: "some other system ... that don't have any Java related software" – madth3 Dec 14 '12 at 05:15
  • @madth3 *"but he says:"* Yes, I saw that when I read the question. What is your point? – Andrew Thompson Dec 14 '12 at 05:19
  • I read both your options as requiring an installed JRE. – madth3 Dec 14 '12 at 05:31
  • @madth3 a) A Jar requires a JRE or it won't run. b) The first ensures it is installed (to a minimum version). c) ..but more [specific JRE version control](http://pscode.org/jws/version.html) (down to micro-versions) can be done using JWS. – Andrew Thompson Dec 14 '12 at 05:42
  • my application is intended for specific individual users ,we are not using any web portal for distributing my app,instead i just wanted to send as a zip file of my app. if unzip it and click on my jar it will run at user machine, not bothering about all about java,jre stuff.is it possible..if not i will go by your suggestions Thank you – krish131 Dec 14 '12 at 07:16
  • *"not using any web portal"* JWS does not require the web. They can be served from an intranet. *"is it possible."* I don't know, I just know it is easy using JWS. :) – Andrew Thompson Dec 14 '12 at 07:19
  • one of my doubt is: now a days any OS is coming by default JRE(Basic version) or not. – krish131 Dec 14 '12 at 07:20
  • *"now a days any OS is coming by default JRE(Basic version) or not."* I vote 'not'. The user should install Java if the user needs Java - just like any plug-in. Our job is to make the installation (if necessary) as painless and invisible as practical. – Andrew Thompson Dec 14 '12 at 07:23