Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 and a folder, between a browser and a web site.

I need to create a Java web app (Tomcat or Jetty) and deploy it in as many of their computers, Windows and Mac.

The question is: Is there a mechanism to distribute an app with its own JRE? (in the Tcl world there are starpacks and starkits, in the Python world there's py2exe and others, that's the idea). And also, is it legal? I know the VM is open source but I'm not clear about the libraries, and I know about GNU Classpath but I don't know if all the packages are there.

I don't want to depend on the installed JRE or on the user having enough privileges to install one. On the Mac I don't want to depend on Apple (I had to switch from Tiger to Snow Leopard just to have Java 1.6, I can't put my users in that position)

Any info greatly appreciated. Thanks! jb

edit: I'm wondering if I can just paste the JRE folder under my app folder. Is that allowed?

like image 680
user179997 Avatar asked Feb 03 '23 04:02

user179997


2 Answers

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.

like image 152
Alinium Avatar answered Feb 05 '23 19:02

Alinium


    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.)

like image 31
mdma Avatar answered Feb 05 '23 20:02

mdma