I have created a desktop application in Java using NetBeans 6.1 and made a jar file of the application. Now I want to make it automatically start up whenever a client's machine boots up.
How do I do that?
There are many commercial installers which can do this
http://www.advancedinstaller.com/jre-install.html
Are you looking for a free/OS one?
Thanks
Krishna
This installer can create a file with "msi" extension that will behave as regular windows installer. It bundles your jar file and JRE together into single file. The program acts as a "wizard", where you configure all necessary options.
Take a look at this product:Advanced Installer
Good luck.
If you simply want to have a java application autostarted in Windows you could just create a link in the users autostart folder calling javaw the same way you'd normally call java.
This is just meant FYI, the other suggestions are more general, of course, but this could be the simplest solution...
҉ works
I have found the following order best suite to take a decision for commercial or free one, to fit your needs (most of the following does auto startup + extra features):
Order show more features on top:
BitRock: see features
i would really use this one, because it does all cross platform + Jnlp + Prerequisite
Tanukio: enter link description here
IzPack
Advancedinstaller: features
(optional) Jnlp web start: example (this should become future way of installing)
Please note that, prerequisite is not mentioned, most of there feature list, which is very important to have in all of them, because many case we use third party libraries/dependencies, so the best question would be to know if they support it or not.
Take a look at Tanuki's Java Service Wrapper. The Community version does what you need, plus a lot more.
If you only need to run a Java program periodically, I like pycron, which installs itself as a Windows service and then reads a Unix style crontab file where you would enter a line that tells pycron when it needs to run the java process (eg, every night at 3am).
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Java is one of my programming languages of choice. I always run into the problem though of distributing my application to end-users.
Giving a user a JAR is not always as user friendly as I would like and using Java WebStart requires that I maintain a web server.
What's the best way to distribute a Java application? What if the Java application needs to install artifacts to the user's computer? Are there any good Java installation/packaging systems out there?
There are a variety of solutions, depending on your distribution requirements.
Just use a jar. This assumes that the user has the the correct java version installed, otherwise the user will get "class-file format version" exceptions. This is fine for internal distribution inside a company.
Use launch4j and an installer like NSIS. This gives you a lot more control, although the user can still do stupid stuff like un-installing the java runtime. This is probably the most popular approach, and what I currently use.
Use Webstart. This also assumes that the user has the correct java version installed, but it's a lot easier to get going. My experience is that this is fine for tightly controlled intranet environments, but becomes a pain with larger deployments because it has some many weird failures. It may get better with the new plug-in technology in Java 1.7.
Use a native-code compiler like Excelsior JET and distribute as a executable, or wrap it up in an installer. Expensive, and it generally ties you to a slightly older version of java, and there is some pain with dynamic class-loading, but its very effective for large-scale deployment where you need to minimise your support hassles.
advanced installer makes it easy to package java apps as windows executables, and it's quite flexible in the way you can set it up. I've found that for distributing java applications to windows clients, this is the easiest way to go.
JSmooth is a simple program that takes your jar and wraps it up in a standard windows executable file. It comes with a simple GUI that allows you to configure the required JVM, bundle it with the application or provide an option to download it if it's not already installed. You can send the exe file as is or zip it with possible dependencies (or let the program download the extra dependencies from the net on startup). It's also free, as in beer and speech, which may (or may not) be a good thing.
If it's a real GUI-having end user application you should ignore the lanaguage in which you wrote the program (Java) and use a native installer for each of your chosen platforms. Mac folks want a .dmg and on windows a .msi or a .exe installer is the way to go. On Windows I prefer NSIS from NullSoft only because it's less objectionable than InstallShield or InstallAnywhere. On OSX you can count on the JVM already being there. On Windows you'll need to check and install it for them if necessary. Linux people won't run Java GUI applications, and the few that will, know what to do with an executable .jar.
It depends on how sophisticated your target users are. In most cases you want to isolate them from the fact that you are running a Java-based app. Give them with a native installer that does the right thing (create start menu entries, launchers, register with add/remove programs, etc.) and already bundles a Java runtime (so the user does not need to know or care about it). I would like to suggest our cross platform installation tool, BitRock InstallBuilder. Although it is not Java-based, it is commonly used to package Java applications. It can be easily integrated with Ant and you can build Windows installers from Unix/Linux/Mac and the other way around. Because the generated installers are native, they do not require a self-extraction step or a JRE to be already present in the target system, which means smaller installers and saves you some headaches. I also would like to mention we have free licenses for open source projects
Although I haven't used NSIS (Nullsoft Scriptable Installer System) myself, there are install scripts that will check whether or not the required JRE is installed on the target system.
Many sample scripts are available from the Code Examples and Real World Installers pages, such as:
Java Launcher with automatic JRE installation
Simple Java Runtime Download Script
(Please note that I haven't actually used any of the scripts, so please don't take it as an endorsement.)
executable files are best but they are platform limited i.e. use gcj : http://gcc.gnu.org/java/ for linux to produce executables and use launch4j : http://launch4j.sourceforge.net/ to produce windows executables.
To package on linux you can use any rpm or deb packager. For win32 try http://en.wikipedia.org/wiki/Nullsoft_Scriptable_Install_System
I needed a way to package my project and its dependencies into a single jar file.
I found what I needed using the Maven2 Assembly plugin: Maven2 Assembly plugin
This appears to duplicate the functionality of one-jar, but requires no additional configuration to get it going.
For simple Java apps I like to use Jar's. It is very simple to distribute one file that a user can just click on (Windows), or
java -jar jarname.jar
IMHO, jar is the way to go when simplicity is a main requirement.
I develop eclipse RCP applications. Normally to start an eclipse application an executable launcher is included. I include the java virtual machine inside the application folder in a /jre sub directory to ensure that the right java version will be used.
Then we package with Inno Setup for installation on the user's machine.
What's the best way to distribute a
Java application? What if the Java
application needs to install artifacts
to the user's computer? Are there any
good Java installation/packaging
systems out there?
In my experience (from evaluating a number of options), install4j is a good solution. It creates native installers for any platform, and is specifically geared towards installing Java apps. For details, see "Features" on its website.
install4j is a commercial tool, though. Especially if your needs are relatively simple (just distribute an application and install some artifacts), many other good options exist, including free ones (like izPack or the already mentioned Lauch4j). But you asked for the best way, and to my current knowledge install4j is the one, especially for distributing larger or more complicated Java (EE) apps.
The best answer depends on the platform. For deployment on Windows, I have had good results using a combination of one-jar and launch4j. It did take a little while to set up my build environment properly (ant scripts, mostly) but now it's fairly painless.
Well from my point of view the superior distribution mechanism is to use something like ClickOnce, or WebStart technology. You just deploy the version to the server and it gets automatically to the clients when the version is released.
Also the Eclipse RCP platform contains UpdateManager that does what WebStart do, but also much more.
Since I am using Maven2 for building, the deployment is just a piece of cake: copy the built jar to the location on the server, update the jnlp file if needed and you are done.
installanywhere is good but expensive one - i have not found (as) good free one
I would zip the jar file along with other dependent jars, configuration files and documentation along with a run.bat/run.sh. End user should be able unzip it to any location and edit the run.bat if required (It should run without editing in most of the cases).
An installer may be useful if you want to create entries in start menu, desktop, system tray etc.
As a user I prefer unzip and run kind of installation (no start menu entries please). However People outside IT industry may have different preferences. So if the application is largely targeted for developers zip-run.bat route and applications for general public may be installed using a installer.
I have been working on a freeware application named "Cyberoam Iview" that has two modules, one written in C and the other in JAVA. Just for you know, this is an online application that requires JDK,PostgreSql database,Apache Server to setup on any host system environment.
I tweaked some changes to the available source-code according to my requirement. After the changes, I want to deploy this application as a one single packaged file, like in ".exe" format. All it's pre-requisites are required to be bundled in a single ".exe" format so that when I run that ".exe" file on my system, it installs and setup every application that it requires to run like installing Postgresql, setting up Apache server environment, JDK.
I read many posts and discussions, and thus tried my hands with CYGWIN tool to deploy the application, but failed to do so.
Suggestions are most welcome. Thanks in advance.
You can take a look at JSMooth. I use this for this purpose. You can create a standalone executeable and it even provides a downloader if no Java is installed.
I have some good experiences with IzPack installer and I can highly recommend it. You can check out my short and simple tutorial at Softwarepassion website - I guess a bit outdated tho.
You should be able to pack your jars and all external files as a single file
Maybe the question sounds a bit strange...
I would like to distribute my Java application.
I know how to generate a jar file, but it only includes my classes.
What if the user does not have java installed on its computer ?
So what I would like to know is how to include the JVM in my JAR file. Or find the equivalent correct way of doing this.
I found almost nothing about this so I'm probably asking the wrong question...
Many thanks !
You can't include the JVM in the JAR file. You can, however, put the JRE in your distribution next to the JAR file - assuming you know what platform (OS, processor) the distribution is intended for. On how to do that, you can read here.
You do not know anything about client computer architecture, you can't provide common JVM for all types of computers (it depends on OS and processor).
It is not possible, you can easily distribute application, but not virtual machine itself.
You may use some application packager like Launch4j that includes a test for installed Java on the host and if needed forward user to Java download/install page.
Your use case is covered by the readme file. You can and you are allowed to distribute the Java Runtime along your application (jar). It is a question how to start then your app accordingly to the OS.
I'm looking for advice on good options to deploy Java applications on end user systems.
Our end users are not tech savvy experts but casual computer users who can't be expected to figure out directories and version conflicts.
Runnable jar is not practical because we need to provide VM parameters. Batch files are not practical because for whatever reason, java.exe is not on the $PATH in a huge amount of Windows system.
Webstart is an option, but our users commonly complain that no shortcuts are created (a feature that's apparently broken), every click on the website prompts a new download, and a plethora of other issues make this option seem incredibly unprofessional to the end user.
Many of the things one finds when googleing for Java deployments are themselves built with Java, which means they won't run either on a system with a missing or broken Java installation.
If you do not want to spend any money, a popular solution is izpack.
If you're looking for a commercially supported solution, there is install4j (Disclaimer: My company develops install4j). The installer is a Java application here as well. However, it is started by a native launcher that can download a JRE bundle from your server on the fly. You can also statically bundle a private JRE. See here for more information on JRE bundles.
Webstart is an option, but our users commonly complain that no shortcuts are created (a feature that's apparently broken), every click on the website prompts a new download, and a plethora of other issues make this option seem incredibly unprofessional to the end user.
Many webstart deployments are quite unprofessional. Make sure any deployment that is showing problems is validated using JaNeLA. For the shortcuts specifically, look into the IntegrationService of the JNLP API for establishing them after launch, with feed-back.
Ultimately though, APIs will have bugs. If you find one in web start, please report it on the bug database (v. broken at the moment, but you have to try).
Many of the things one finds when googleing for Java deployments are themselves built with Java, which means they won't run either on a system with a missing or broken Java installation.
As to missing or too low version Java, use deployJava.js to ensure a suitable JRE is present. No ideas on the broken installs.
I doubt you will swing back to JWS for this immediate deployment, but please investigate it according to the ideas outlined above, for future use.
Now, don't get me wrong, I am a very competent programmer, but when I program, I typically develop things for the web using scripting languages like JavaScript, PHP, Python, SQL, etc. If I want to develop Java software (I am relatively experienced in Java), how do I distribute it?
Is there any good way to package up Java software in a nice little executable, send it out, and have it run? Alternatively, is there any good way to package up Java in some sort of installer, and send it out to be installed and run?
I'm using Launch4J http://launch4j.sourceforge.net/ it will generate an .exe executable for Windows, if the targeted system don't have JVM, it will tell user to download and get JVM.
You can package Java applications in so called jar-files using the jar tool or any competent Java IDE. These jar-files are self-contained and seldom need any installer.
These .jar files can easily be distributed and executed.
If you're used to web-development, you may also be interested in the Java Webstart technology.
Some links to get you started.
Export to a .jar-file in Eclipse
Lesson: Java Webstart
I have found two approaches to work well, depending on the needs of the end user.
1) Java WebStart - allows for central distribution and easy maintenance, but works best for online users. Require you to have a web site to locate the files - these days this is easy to do on the Google Application Engine.
2) Wrapping up the Java program in a single jar using one-jar, and then using jsmooth to generate an .EXE file which ensures Java is available, extracts the jar-file and invokes Java on it. This works well for users not always on the net, where you want the launch process to be transparent, but is less easy to upgrade than the webstart approach.
I use Maven to handle all the dependencies of my projects and that way when you utilise Maven to build your projects they will compile into one nice executable jar that contains everything so you dont need to worry about getting all your third-party jars in the right place etc.
There are a couple of ways: one is to create an installer that allows your user to install and run it. For this you can take a look at NSIS.... or you can just use Java Web Start where your user can just click the link and launch your application.
Here you will find a large set of options: Open Source Installers Generators in JavaIt is very useful for the "naive" customer or user of your application, to make the installation process as painless as possible. Let them install whatever is needed, DBMS, JVM, JMF and additional options via one installer.
You can also consider use one of the rich client platforms available for Java. The learning curve is probably a lot higher than just creating a jar file and ship it, but you will get a lot for free when it comes to distribution. (Think Eclipse with auto update through an update site).
Do a search for "Eclipse RCP" and "Netbeans RCP" and you'll find the two biggest contenders here. I also performed a serach for "eclipse RCP installer" and one of the hits seems interesting:
http://download.instantiations.com/RCPPackagerDoc/integration/latest/docs/html/gettingstarted/GenInstaller.html
I personally like izpack. It generates a jar file installer that you could wrap up in launch4j, supports things like windows specific shortcuts, is highly customisable through XML and hooks directly into ant.
OneJar is great for smaller stuff, but for larger programs or applications it's nowhere near as flexible and in my experience is rather slow.
Hello you can make an installer for your application.
In the link below you will find a nice help about izpack installer.
http://www.imrantariq.com/blog/?p=89
Link below contains a detailed pdf to make installer with izpack.
http://www.imrantariq.com/blog/?attachment_id=112
cheers