Java packaging tools - alternatives for jsmooth, launch4j, onejar - java

I have used these three open source tools for packaging my java apps, but they all look like abandon-ware now. All three are very good pieces of software. What are the options now? (or is using Java for desktop app development no longer a "hot" market for app developers to build & maintain these tools?).
1) exe wrapper:
jsmooth - no new development in 2.5 years - does not support 64 bit.
launch4j - no new development in over a year, supports 64 bit, but you can't sign the exe created by launch4j, so I prefer jsmooth, but it does not support 64 bit.
2) onejar:
It works, but there has been no new development or web site update in more than 2.5 years. So, just want to switch to something that's supported / have a backup plan if it suddenly breaks with a new build of Java.
Thanks
Edgar

Launch4j has just been updated ! http://launch4j.sourceforge.net/changelog.html

Did you check IzPack? This is a great piece of software to create cross-platform installers:
IzPack is an installers generator for the Java platform. It produces lightweight installers that can be run on any operating system where a Java virtual machine is available. Depending on the operating system, it can be launched by a double-click or a simple 'java -jar installer.jar' on a shell. The most common use is to distribute applications for the Java platform, but you can also use it for other kinds of projects. The main benefit of IzPack is that it provides a clean and unique way of distributing a project to users using different operating systems.
Some really famous companies and projects use it for many years (Sun Microsystems, JBoss/RedHat, the Scala language project, some ObjectWeb/OW2 projects, XWiki and many more). If it's good for them, it should be good for you :)

Since none of the answers were approved, and JavaFX 2.2 has not been mentioned above (was not available at the time of the answers) here goes:
JavaFX 2.2 (part of Java Runtime and SDK since 7u6) allows building native exe/dmg/rpm's that tag along the full RT component as well. I believe this is a valid answer to your need, as well as an officially supported solution from Oracle.
https://blogs.oracle.com/talkingjavadeployment/entry/native_packaging_for_javafx

Have you tried IzPack (http://izpack.org/)?

You can try
http://winrun4j.sourceforge.net/
Has an exe with 64bit support and is quite easy to configure with an ini file.

As I was fed up with recent security changes in Java Webstart, I created my own tool, JNDT. It's under GPL.
It goes farther than akauppi's suggestion because it allows to create GNU Linux packages even under Mac and Windows :) I use it to create Mac bundle under GNU Linux too. For the moment, it's just a single Ant library with a few dependencies that allows to create native self-contained application bundles for GNU Linux, Mac OS X and Windows. I use it for my first person shooter and I'm very happy with it. It bundles the JRE but it can use the system JRE if you want.
P.S: JNDT is able to create a native Windows installer as an executable with NSIS even under GNU Linux.
I understand that the GPL license discourages some developers to use my tool. In this case, rather use PackR.

Maven 2 provides the ability to create a jar which contains all the dependencies as part of its assembly plugin. This combined with the jar plugin configuration of the manifest file (and specifically setting Main-class to the Class with main) is all you need to do basic packaging.
To some extent Java web start is now considered the better way to distribute Java applications and Maven 2's assembly capability combined with web start gets you everything you need without going via the exe route.

If you just want an exe (instead of a full-blown installer) you can make one with NSIS:
http://nsis.sourceforge.net/Java_Launcher_with_automatic_JRE_installation
Yes, NSIS is an installer but you can have it just run a jar in the same directory by stripping out all of the installer stuff. Basically it works like launch4j but is a lot more configurable.

If you are using gradle, there is a plugin that uses launch4j (under the hood) and works great. It doesn't even require you to download or install launch4j, it is totally automated.
https://github.com/TheBoegl/gradle-launch4j

Related

want to make setup files of my java mysql project

I have done a restaurant management project with java fxml and MySQL using intellij idea. Now i want to make a setup file like other software available. I want to make sure that one can easily install the setup file in his computer without installing JDK or other things. And how can i consider my software licence issue? I already tried some jar to exe converter software but failed to do it. Need some help.
Write a custom installer (with native operating system language)
If you are targeting multiple OSs, make for each one "install program" written in its native format. This idea is used by many Java projects, including Netbeans IDE which contains a small C++ runner for windows, linux and other systems. The Netbeans launcher verifies JDK exists and starts up VM with desired arguments. Here you can take a look at it http://hg.netbeans.org/main/file/96711149dcd2/ide/launcher
For example, you write a custom .NET installer for windows that checks if JDK is installed or not, after that it installs your system. The same thing would be for Linux or any other OS.

Java exe launcher with support for Windows 7

The Problem
Currently I use exe4j 4.4.2 to wrap our client app in a Windows native executable, but the result does not integrate with Windows 7 so well.
For example: When I right click in the task bar it only offers a pop-up to close the application but no pinning. Eclipse' Equinox launcher on the other hand does that with bravado.
I'm looking for a java exe launcher which has the following features:
Wraps jars in Windows native executables (no Java Web Start or similar)
Doesn't extract the jar from the executable
Doesn't need write access in "Program Files"
Uses executable filename as process name (only one process)
Integrates well with Windows 7 (esp. pinning in the taskbar)
Allows setting of JVM arguments (esp. heap size)
Flexible customization for JRE search
Lightweight
Actively maintained
Integrates well in Ant build
Preferably free
I have checked the following:
exe4j
Windows 7 integration lacking
It's not expensive but ordering and
distribution of licenses to the build machines is a pain.
JRE search not flexible enough
Eclipse Equinox
Not lightweight
Seems to do everything I want, except that I have no idea how
to use it with a non-eclipse-based app.
Can I use it outside of OSGI, PDE-Build world?
WinRun4J
JRE search not well documented
Seems not widely used despite incredible feature set, what am I missing?
Launch4J
Doesn't support setting the process name in Windows 7 (Bug ID 3353972).
There is a patch (Bug ID 1670471) but it has been rejected with reference
to jliftoff which is dead.
JRE search not flexible enough.
JSmooth
Seems not to be actively maintained.
Latest release is from 2007, well before Windows 7.
Are there any other options?
Is there a chance to use the Eclipse launcher with a non Eclipse-base application?
Try Advanced Installer http://www.advancedinstaller.com/java.html (There is a free edition available in this).
I'm happy with WinRun4J. The JRE search works fine for me. It sometimes chokes especially on 64bit systems if multiple JREs and JDKs are installed and registered in the Windows registry, but this can usually be fixed by supplying the correct path in the corresponding .ini file.
I did not use Launch4J because it creates a new (temporary) .exe in the JRE installation folder which seems a bit strange to me. The advantage of that method is, that it can use a single .exe for both 32 and 64 bit JVMs though
It sounds to me like you just need to go with Launch4J. The process name matches the .exe name that you launch with. A great example of a program that is wrapped this way is "Keystore Explorer 4.01".
I would create a bat file. Wrap this bat file into a exe. You can create an exe with an icon and everything. Try this bat to exe converter:
http://download.cnet.com/Bat-To-Exe-Converter/3000-2069_4-10555897.html
In this way, you have better control. The size of the exe is very small.
Edit: Also, the creation of the exe is one time thing.

How to create native binaries for your Java app? [duplicate]

This question already has answers here:
How can I convert my Java program to an .exe file?
(16 answers)
Closed 3 years ago.
I'm wondering how to package a Java application into a native binary for Windows, Linux and Mac OS X.
I know Minecraft does this, but I can't figure out how. This is what'd I'd like to do:
From NetBeans (preferably) or Eclipse, build the three binaries automatically.
Include native libraries for OpenGL et. all.
Obfuscate my code if possible.
If there's some way to mimic the Minecraft auto-updater feature, that'd be totally awesome.
So, are there any tools available to do this for you, or do I need to write a large bulk of XML to accomplish this?
To make a native binary for Windows, you would use a tool like Launch4J. On OSX you could use JarBundler. Minecraft simply distributes the jar file for Linux. I'm not aware of a native binary packager for Linux.
You could also compile your Java code via GCJ but that's probably not what you want, as there are limitations and compatibility concerns there. The native bundlers like Launch4j and JarBundler simply wrap your jar file and use a real JRE to execute it.
As for integrating with NetBeans or Eclipse, you'll probably have to write your own ant build file, especially since the solution varies from one platform to the next.
If you are using Java 9, you can also use Java 9 Modularization & jlink to ship a zero-dependency native app.
There is also maven-jlink-plugin that could help here.
Take a look at GCJBuilder plugin for eclipse. Not sure if it supports cross compilation as the command GCJ compiler does.
If the app. has a GUI and can be distributed from a web site, look into Java Web Start. JWS is supplied by Oracle, and provides auto-update amongst many other features.
Note that JWS uses Jar files, so no conversion is necessary.
I've used JSMooth for this in the past: http://jsmooth.sourceforge.net/
As mentioned before, this wrapper just looks for a real JRE to run it - it does not come with a bundled JRE.

How can I create a Windows .exe (standalone executable) using Java/Eclipse?

I'm new to the programming scene. Been working with C++ for about 5 months now, and have decided I want to start getting into Java. I'm using Eclipse as my IDE, and obviously Java for the language. I'm trying to write a simple HelloWorld application, which can be run through a command prompt executable.
In Visual Studio, it seems it's rather easy to create an executable. All I've ever had to do is use a pull down arrow and choose Release, and then run my build. The purpose of wanting to be able to write/run Java in command prompt is so that I'm able to practice some of the language basics before I go in full force with Swing.
So bottom line, what is the easiest way to create a command prompt .exe written with Java?
Thanks in advance!
Java doesn't natively allow building of an exe, that would defeat its purpose of being cross-platform.
AFAIK, these are your options:
Make a runnable JAR. If the system supports it and is configured appropriately, in a GUI, double clicking the JAR will launch the app. Another option would be to write a launcher shell script/batch file which will start your JAR with the appropriate parameters
There also executable wrappers - see How can I convert my Java program to an .exe file?
See also:
Convert Java to EXE: Why, When, When Not and How
Creating a native installer using jpackage
A java packaging tool named jpackage was released as part of the Java Development Kit (JDK) version 16.
This tool works in conjunction with native packaging tools for various platforms (e.g. WIX for Windows, RPM, and DEB for Linux distributions, DMG for Mac) to allow building native installers for Java applications which can then be run as executables. For distribution, it may be possible to distribute just the executable for the application, independent of the installer (I don't know, I didn't try that).
A nice, tutorial style, blog post that describes the use of the jpackage tool to create a native Windows installer for a Java application is:
How to create a Windows Native Java application (generating .exe file)?
Customizing the runtime image using jlink and jdeps
The packaging tool can (optionally) be combined with the jlink tool:
jlink - assemble and optimize a set of modules and their dependencies into a custom runtime image
This allows you to customize the runtime image for your application to only include the required custom selected modular parts of your application code, java runtime, and 3rd party libraries, rather than distributing a complete java runtime.
Optionally, you can also use the jdeps tool to determine inputs to jlink.
Complete discussion of usage of jdeps + jlink + jpackage + a native bundle creator (e.g. wix/rpm/deb/dmg) is outside of scope for a StackOverflow answer, but various resources can be found on the web if you search.
Creating a standalone .exe instead of an installer
This can be done using warp-packer to create a exe out of the image and app launcher created by jlink.
How to create a standalone .exe in Java (that runs without an installer and a JRE)
Third party tools can help deliver a solution
If you wish to use all these tools in combination, things can get complicated, and I'd advise using a 3rd party utility or template to help perform this task. For example:
badass-jlink-plugin (documentation) -> "allows you to create custom runtime images for modular applications with minimal effort. It also lets you create an application installer with the jpackage tool."
For JavaFX specific applications (as your question has a JavaFX tag), you could review:
JPackageScriptFX -> "demonstrates how projects can use scripts to build self-contained, platform-specific executables and installers of their JavaFX applications via the jdeps, jlink, and jpackage tools."
For native mobile deployments, see Gluon Mobile
This question was Windows specific, but for completeness, if your target is native application deployment on a mobile device, then likely you will need to use a 3rd party solution such as Gluon Mobile.
Background Rationale (ignore if not needed)
creating a native installer using jpackage might be a bit of work, so why would you do it?
Here are some reasons:
When an application is distributed via an installer created using jpackage, that application can be installed on a target system without requiring the user to manually install other dependencies (such as a Java Runtime). The installer will take care of ensuring that your application and any dependencies it requires are installed.
The application ships with its own customized version of the Java Runtime. This means that if the user doesn't install a JRE, and, if they have installed a version of the JRE which is incompatible with your application, your application will still function correctly.
The application can be installed and uninstalled using standard OS facilities for the target platform. Most users of those platforms are familiar with these.
Yes, Java is cross-platform for the most part, but many users don't care much about that, instead they just want a smooth and familiar installation (and uninstallation) experience for their application and jpackage can help accomplish that.
Typical Java programs compile into .jar files, which can be executed like .exe files provided the target machine has Java installed and that Java is in its PATH. From Eclipse you use the Export menu item from the File menu.
Creating .exe distributions isn't typical for Java. While such wrappers do exist, the normal mode of operation is to create a .jar file.
To create a .jar file from a Java project in Eclipse, use file->export->java->Jar file. This will create an archive with all your classes.
On the command prompt, use invocation like the following:
java -cp myapp.jar foo.bar.MyMainClass

What are the standard options for creating install packages for your software application?

What are the standard options for creating install packages for your software application? I notice that most install packages on windows seem to look the same, which leads me to believe that there is probably one standard/default option for building an installer?
My application is java based. My install "requirements" are pretty standard: kick off third party installations; run command-line scripts; move files around
Also, I would prefer an option that allows me to build an installer for both windows and linux.
If you are ready to pay for license, "InstallAnywhere" is a good solution.
I have used open source ant installer a while ago. If you are good with ANT builds, you can use ant installer; it s cross-platform.
If you were doing only Windows, the standard is MSI. This is Microsoft's own technology for Windows installations, and there are software bits out there to help you build MSI installers. MSI is a Windows-only solution though. If you want to support both Windows and Linux, you're going to need something else.
Give InstallJammer a look. It's free, open source and supports Windows and Linux beautifully.
This has come up before...
Multiplatform Installer
The answer given there sounds like the kind of thing you're looking for. http://izpack.org/
As other posters have mentioned, on Windows MSI is a standard solution. For crossplatform installers there are several options, most of them Java based. My company product, InstallBuilder, is one of the few that creates native, non-Java based installers. I mention this specifically because as your app may be Java based, you want to the installer to have minimal overhead and not have any requirements for bundling or searching for a Java runtime during install time, since that will cause all kind of problems

Categories

Resources