Java archive file distribution and execution
I've made a Java program I would like to make available to people of every stripe of computer (Windows, Linux, and OSX). So, as far as I know, all I have to do is make a Java archive, and the end users are able to run it with their particular flavor of Java.exe file.
If the above is c开发者_如何学运维orrect, my questions are :
1) Is it possible to download each of the three kinds of Java.exe file from somewhere and package them together with the Jar file (do the end users have to have more than the appropriate Java.exe file to run the Jar file)
2) Is there a utility with which I can make the appropriate kind of zip file for each of the three kinds of destination machine (i.e., zip file, gzip file, and from what I have found on the web, an OSX zip file).
These days, java is considered a mainstream OS add on, like adobe reader, flash, and other very common "plugins".
Including java with your distribution is a very bad idea. Mainly because it's big and you then take on supporting latest releases.
Just send out the jars etc and perhaps a some shell scripts (.bat for windows and .sh for unix/linux) to start up your app. This is a common patter used by mainstream open source software, including Apache Tomcat, which is used by 1000's of sites.
If you want to get fancy, your scripts could detect if java is installed and redirect the user to the appropriate download page to install java.
The best strategy if your app. has a GUI & you can distribute from a web site is to deploy the app. using Java Web Start. Use deployJava.js to (help) ensure the end user has a suitable minimum version of the JRE.
Note that even that will not work to get the app. running on all computers. Some have no JRE and no user permissions to install one.
精彩评论