Automatically Open Java App After Finish Install Java JRE from java.com - java

I am currently working on java application project. My application need to run on Java Runtime Environment (JRE). I have wrap my jar file into .exe file,
When the user clicked our .exe file, if the user dont have JRE installed in their device(Windows OS computer), they will be direct to java download here. This link will download and install the jre to user computer.
to ease user, my superior instruct me to automatically open our java application after the jre have finish installed into user computer. is it possible, if yes what is the common practice of how to do it.

After a while of research, i conclude it is not possible to do that in this current time but instead the best alternative is to let the installer to check for JRE environment before installing our application. User will have to download and install first JRE and only after that they will be allowed to finish the installation. i use advance installer for installation package.

Related

What is the best way to embed JRE 8 Installation in the Installer for my app?

I have a java application and I created an installer using Wix Toolset. I added a check to my installer does have user installed Java and what is its version.
Now I don't know what to do if user doesn't have installed java.
let my installer set up JRE 8 (the JRE installer will be in the application installer) after the user consent?
OR
Is it more correct to just give the user a link to download the JRE 8 installer from Oracle official website?
It all depends. Do you want the extra size and complexity of including Java? Would your users know what to do if you didn't do it for them?
Another option is Self Contained deployment where you app has it's own isolated version of Java. Easier with some upsides and downsides that can be read here.
https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html

Automatic and seamless way to install a JVM when distributing app

Let's say I want to distribute a Java desktop app in a native-like way. Is there a tool/technique to build Java desktop application installers that will automatically and seamlessly install a JVM if one does not exist on a system already?
Installing Java apps for users who do not have a JVM is a 2-step process (first install the JVM, then the app). I'd like to match the experience of installing a typical native desktop app by making it a one-step process (or as much one-step-ish as possible).
For Windows, I suggest using NSIS installer to wrap installation of the JRE and your program. That will allow real "installation", ie. JRE will be installed to Program Files and it will be possible to uninstall it from Windows control panel ("public JRE"). You need to bundle the JRE installer for that.
Alternatively, you can bundle the whole JRE ("private JRE") together with your program. You can use Launch4J which configures the launch of your Java application (VM options, classpath etc.) as an EXE file, have the JRE somewhere as one of the folders of your distribution and point Launch4J to use it.
Or, simply have the unpacked JRE ("private JRE") in one of the folders of your distribution and use relative paths to use that one instead of the one installed on the system.
The advantage of a private JRE is that you control which Java version it is. With a public JRE, the user may be able to uninstall it or change the version and then come complaining that your program is not working ;)
For Linux, if you distribute you application as an RPM, you can just declare a Java package to be your dependency. Linux package manager should take care of it all. On the other hand, you can still bundle JRE in your own RPM to be independent of the "main" version installed on the user's machine.

Portable Eclipse with JRE

I'm not able to run a majority of programs from my work computer due to JRE <= 1.6 does not support switch statements for Strings. As I'm not able to install or update due to admin restrictions, would it be possible to create a portable Eclipse on a USB that incorporates the JRE (1.7) as well?
The Eclipse part is easy. Just unzip Eclipse on your USB.
You'll have to install Java to your USB. Afterwards, go into Eclipse Window -> Preferences; Java -> Installed JREs and make sure your Java JRE or JDK is listed and the default.
Create your workspace on the USB, and you should be ready to go.
It's fairly easy to run Eclipse on a USB drive. You just need to make sure it knows to look for Java on your USB drive rather than on the host computer.
If you have Java Portable installed on your drive, you can tell Eclipse to use it by adding the following to your eclipse.ini file.
-vm
/PortableApps/CommonFiles/Java64/bin/javaw.exe
Note that Eclipse Portable stores the file as EclipsePortable\App\eclipse\eclipse.ini.
In my experience, since Eclipse upgraded from Indigo to Juno, the .zip they provide is already portable. It no longer creates any folders or files in the Windows user data folder.
Just put your eclipse and jdk7 on the flash and run from flash. Set JDK in eclipse: Window->Preference->Java->Installed JRE...

Any way to run an exe made from jar using exe4j from another computer?

I've made a little GUI program to enter contents then send "javamail" to my email. I have to import many jar libraries from javamail-1.4.5 and then I build it (shift + f11) to jar, then use exe4j to make it exe (also add all the jars from the libraries in the /dist/lib) and version of jre from 1.5 to 1.7 (I'm using 1.7 to make this app). It works smoothly on my computer but when I give the exe to others computer. It said:
"No JVM could be found on your system. Please define EXE4J_JAVA_HOME to point to an installed 32-bit JDK or JRE or download a JRE from www.java.com"
I think they must install the JDK in order to be able to run the app. But it may be confusing to many of my friends who don't know about computing. Is there anyway can they use that send-javamail-app without asking them to install the JDK?
Thanks in advance and sorry for my English!
It's quite simple.
After you have done basic steps as set the name, icon, etc, in step number 6 JRE is where the magic happens:
Click Advanced Options and select Search sequence
Click to add new item + and select directory
Select your jre directory, it must be a relative path
Put your new item at the first position in list
After that what you have to do is release your exe with the jre directory together, to do that usually I use Inno Setup Compiler to create a installer.
You can bundle the JRE with your product, this is the best way you can achieve without bothering your buddies. The size of your application will increase.
JRE is required to run any java application.
Hope this helps.
Java Runtime Environment (JRE) is required to run the Java application. In order to install JRE on a computer without Java installed, you must either bundle it (put it inside your application), or ask your friends to download JRE.
I don't know exactly how to bundle JRE, but the question Bundling the JRE with a Java application can probably help.
Maybe my personal project Java Customization Builder can help you, it analyzes the classes used by your program, and slim these classes from jars, and it also analyzes jvm files used by your program. Then it make an executable file and pack200 the jre runtime and your program.
JCB Project Introduction:
Java Customization Builder is a tool which customizes your java application and JRE.
It is a java application building tool enabling you to generate a very small java archive package which has a slimmed jre. For the swing application, the archive is less than 5M, for the SWT application, the archive is less than 3M usually. And the customed java applicaton can run on the Windows which doesn't install a JRE, and be loaded by an executable.
JCB project page: http://jcb.sourceforge.net

making an installer and installing the libraries if not already installed

How can i make up am installer for my java application (jar file) . The same as that of windows installer which proceeds by clicking next and installs the application. What i want with my java app is, the open source library xuggler to get installed if it is not already present in the system.Then i want JRE to get installed if it is not already present in the system.
If the user does not have xuggler or JRE installed , installer should automatically install the xuggler and JRE. Or it should tell the user to get that version of libraries from the given URL and then continue.
Your question is similar to this one:
how to package a java application
Advanced Installer has a separate edition especially for creating installers for Java apps, so this might be what you are looking for. I would recommend other tools but since they're scriptable, they're a hassle to work with, lots of things can go wrong.
Hope this helps
If your app. has a GUI, use deployJava.js for the JRE and then Java Web Start to install/launch the app.
An installer-desc can be specified in the JNLP file to install Xuggle. JWS can partition the download between OS.
JWS is supplied by the makers of J2SE JREs for desktop PCs (e.g. running Mac OSX, *nix or Windows).
NullSoft have a very good scriptable, opensource installer called NSIS.
http://nsis.sourceforge.net/Main_Page
I'm not aware of a cross platform way to do this. In the Windows world, you can use Wix to generate an MSI file, and in that file you can specify dependencies such as the JRE. In the Linux world you can generate a file with the dependencies read by the package manager, a deb file for Debian based releases for example. It's a bit of a faff to set things like this up separately, but once it's done you can just integrate it into your ant script and build everything automatically.

Categories