How can I package a Java desktop application?

2019-03-10 02:04发布

I am working on a simple desktop java application. I would like to make it as seamless to install for end users as possible. E.g. similar to how Minecraft is distributed - a simple executable for OS X and an EXE file for Windows.

What tool should I use?

6条回答
姐就是有狂的资本
2楼-- · 2019-03-10 02:28

Java Web Start I think is the option you're looking for...

查看更多
三岁会撩人
3楼-- · 2019-03-10 02:30

The optimal installation for a cross-platform app. with a GUI is to be found in Java Web Start. To quote the linked document in part:

JWS provides many appealing features including, but not limited to, splash screens, desktop integration, file associations, automatic update ..

Other matters

..an OS specific way of launching the software.

Adding a shortcut (with icon) to the desktop or start/program menu (desktop integration) is about as platform specific as you can get.

..will run without Java and offer to install a JRE if not currently present

Use deployJava.js, linked in the 2nd last list item under 'See also:'.

Well you don't need a separate package per OS if JWS integrates in and looks like a native program.

Using the native PLAF would be a good start.

查看更多
\"骚年 ilove
4楼-- · 2019-03-10 02:30

I think that you're looking for IzPak. There is even a GUI available called PackJacket

查看更多
再贱就再见
5楼-- · 2019-03-10 02:32

Aaah! I also had that question. Users of your Java app must have the JRE installed in order to run it.
You can either tell them to install Java first, or distribute JRE with your app, as Processing does.
Note, however, that your packaged program will be heavy if you include JRE with it. And, if you want to do that, users will need to download the appropiate package for their platform.

Executable Java Wrappers

They take your Java app as input and wrap them in an executable (for a specified platform). You can customize them as you like; and if the user doesn't have Java installed, the download page will open.

Some examples are Launch4J, JSmooth and Jar2EXE.
 

Installers

They are independent applications configured to copy your app files to the user's computer and (optionally) create a shortcut.

Some installers are written in Java, so they're multiplatform. In this case, the installer is a .jar.
Some others are platform-dependent, but you have the advantage that you don't need to wrap them.

Java installers: IzPack, Packlet, PackJacket, Antigen, …
 

Java Web Start

It's a Java feature that allows you users to easily run your apps. You give them a .jnpl file,
they open it, and Java downloads the latest version of your app and runs it. No packaging troubles!


See the complete list of resources here.

查看更多
Rolldiameter
6楼-- · 2019-03-10 02:33

Are you looking for something like this:

http://www.regexlab.com/en/jar2exe/

?

That allows the enduser to run the .exe without installing.

查看更多
萌系小妹纸
7楼-- · 2019-03-10 02:37

There are a number of options - Java web Start, 3rd party installer, etc.

Have a look at http://mindprod.com/jgloss/installer.html for an explanation.

查看更多
登录 后发表回答