Is there a mechanism to distribute an app with its own JRE?

前端 未结 4 795
攒了一身酷
攒了一身酷 2020-12-16 03:33

These fine folks are my users: http://www.youtube.com/watch?v=o4MwTvtyrUQ

If you don\'t want to enjoy the video here is the gist: my users can\'t tell between a file

相关标签:
4条回答
  • 2020-12-16 04:09

    In OS X you pretty much are stuck with whatever Apple provides you. In other platforms, it is not needed to run a JRE installer (which you correctly point out your users may not be able to do), just bundle a JRE folder alongside your app. That is what many of our users do (my company has a multiplatform installer called InstallBuilder) and we have packaged many Java web apps that way. You can take a look at some of them at BitNami (they are all free)

    0 讨论(0)
  • 2020-12-16 04:13

    Or in short, you can try this:

    Make a self executable jar file of your app.

    • Provide your users small JRE setup (appx 15MB for jre6u7) along with your app.
    • Now create a batch file(for windows) which will first execute the JRE installer.
    • Then select path to installed JRE's 'bin' folder.
    • Now after this write 'java -jar yourAppName.jar' in the script to run your executable jar file.

    eg: for win.bat write the following:

    jre-6u7-windows-i586-p  :: this will start the JRE installer
    C:\Program Files\Java\jre1.6.0_07\bin\java -jar yourAppName.jar  :: this will start your app
    

    You can create such scripts for Mac and Linux also.

    0 讨论(0)
  • 2020-12-16 04:25
        To run your application, a user needs the J2SE Runtime Environment,
        which is freely available from Sun. Or, You can redistribute the 
        J2SE Runtime Environment for free with your application, according 
        to the terms of the Runtime Environment's license.
    

    From http://java.sun.com/j2se/1.5.0/jre/README

    I haven't read the fine print, it seems that Sun intends for people to redistribute the JRE. Also, there are many products (e.g. install4j) that make it easy for you to redistribute the JRE, so it seems to be legal.

    As to the rest of it, you could then also bundle tomcat, with the built in Service so your app is automatically started, and create a shortcut on the desktop to your local webapp, so users are freed from typing ht tp://localhost:8080/webapp. There are plenty of FOSS installers (e.g. izpack) that will allow your users to install the package, and manage creation of desktop shortcuts. You mentioned preferring not using an installer, but even unzipping is kind of installing - your users have to choose a directory that they have write access to, and this is no different with a fully fledged installer.

    But, given the capabilities of your users, is a locally installed solution the most suited to them? An online solution might offer simpler deployment (e.g. Java web start, or even as an applet.)

    0 讨论(0)
  • 2020-12-16 04:30

    We use Install4j at our workplace. It takes care of installation and installs the JRE if needed too. Its not free though. And at least the version we use doesn't provide Mac users with a bundled JRE. But as far as I was able to find out, that was due to some restrictions by Apple. Macs come with their own JRE and if your user has a Mac, its safe to assume they have a JRE installed. Although, if the JRE is an older version than the one you like, then they would have to use Software Update to check if a newer version is available and install it.

    0 讨论(0)
提交回复
热议问题