views:

183

answers:

3

Hello all,

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?

+4  A: 

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.

Alinium
+1 For install4j.
lexicore
@Alinium: Unfortunately I can't assume my user to be allowed to install anything, so I'm looking for a "unzip and run" kind of distribution.
+2  A: 
    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.)

mdma
@mdma: I guess I should have read that README before. Thanks for the answer. The locally installed solution is because I want them to keep their data in their own computers (the opposite of "the cloud"). Since I write mostly server code I never had to worry about distributing the platform. It is messy. I wish there was something like web2py (python) for Java. Thanks again. - jb
A: 

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)

Daniel Lopez