Re: Build standalone executable
- From: Ian Wilson <scobloke2@xxxxxxxxxxxxx>
- Date: Tue, 31 Oct 2006 14:53:31 +0000
carl.manaster@xxxxxxxxx wrote:
Hi, all,
I'm sorry if this is a silly question,
Don't be, it isn't.
but I've googled without
success. I have a little applet that processes some numbers and plots
them; it uses classes from my own body of code and from libraries like
JFreeChart. I want to package this up into a standalone application
that I can put on my colleague's desktop so he can try it out. We're
both on the same OS, Windows. I'm using Eclipse.
I have wrapped the JApplet up with a main() that creates a new JFrame,
pops the applet into it, and handles window close. I can run from the
Eclipse environment as either an applet or an application. It does
what I want. I don't want to put it on a web page, just create a
standalone executable. It does not need to be able to run across
multiple platforms; just Windows. What are the steps to do this? I
would like for Eclipse to figure out the dependencies and bundle
together whatever classes it needs. No fancy icon, just something my
colleague can double-click to launch. Thanks for any help with this.
This is a FAQ, the answers I've seen include:
1. Create an executable Jar. These can be run by double clicking and icon on a Windows PC which has a JRE installed. It won't work without a JRE. AFAIK this is the only deployment option supported by plain old Eclipse. Eclipse can produce the Jar but doesn't package it in an installer (setup-appname.exe). There are at least a dozen 3rd party installers that will package up a Jar file for installation. The commercial/proprietary ones seem the most fully featured. Some installers still depend on a JRE being already installed on the target.
2. Use Java Webstart. This works well once the JRE is installed. I suspect the whole installation process, for a brand-new Windows XP PC without JWS/JRE preloaded, is still rather longer and more complicated than most people would want.
3. Use an EXE wrapper. E.g. JSmooth. This can also take care of finding a suitable JRE and downloading it as needed. Installing a JRE is still an intrusive operation for end-users.
4. Compile to native binary. E.g. Gnu GCJ and Gnu Classpath. http://javacompiler.mtsystems.ch/ is one packaging of GCJ. Excelsior Jet is a commercial solution. No JRE required AIUI.
With 3 & 4 you can use a normal Windows installer to install the exe with desktop icons etc.
As I see it, each of the above have their pros and cons, so no one solution is right for all circumstances.
Some selection criteria (targeting Windows):
- How big is the installer bundle?
- Does the user have to work through Sun's JRE download procedure?
- Do shortcuts get installed (with icon) in Start menu & Desktop?
- Does the app get listed in Windows Control-Panel Add/Remove Programs?
- Is the running app listed under its own name in Task Manager?
For a one-off, small app, targeting a friend/colleagues PC, I'd use an executable Jar. YMMV.
--
Ian.
.
- Prev by Date: Re: JavaBeans and ArrayLists
- Next by Date: Re: parse a textfile containing japanese characters
- Previous by thread: Re: JavaBeans and ArrayLists
- Next by thread: Re: parse a textfile containing japanese characters
- Index(es):
Relevant Pages
|