Improvement: decoupled jre version for installer and application possible? - install4j

For now it seems to be impossible the decouple the jre for the main application from the jre used by the installer/updater itself. But sometimes there is a reason to use two different jre/jdk. Maybe the application needs java 8 and the installer is built with java 7 or older. Or maybe there are two applications to install which use two different java versions. Another idea is to create some kind of a meta installer that decide during runtime whether to install 32bit or 64bit java depend on the underlying platform architecture? The installer itself then has to use a 32bit version. So what about to decouple it and configure the jre for the application launchers itself independend from the java version of the installer/updater?

Starting with version 6.1.2 the launcher wizard will have an option to configured the JRE search sequence differently from the installer.
The setting will be available under the "Java invocation->Override Java version" step.

Related

Does install4j need a jre on the clients system?

I don't want to be dependent on that java is installed on the system or not
Our product already ships internally with a vm so the user doesn't have to install any java or need to have any java installed.
But this i also want for my installer of our product, there should be no need to have java there on the system to install the product, is this possible with Launch4J?
Because it is always tricky when reading the docs, you can bundle a jre, but what does that mean? Does the installer use that itself?
Yes, a JRE is necessary to run the installer, but you can bundle a JRE with install4j, so no "global installation" of a JRE is requried.

Is JavaFX available for every Java VM?

I followed the "JavaFX is going to replace Swing" advice mentioned in several places (SO, Wikipedia, Oracle) but that seems to be a white lie. When I run a JavaFX app with IBMs V9 (build 2.8, JRE 1.8.0), I get:
java.lang.ClassNotFoundException: javafx.application.Application
I couldn't find any resource which explains whether JavaFX is a cross-VM technology or whether this is just another vendor-lock-in "feature".
Where is JavaFX available? If it's not available in some VM, can I install it or bundle it with my application?
JavaFX is not available for every Java VM. For instance, Oracle Solaris Java distributions do not include JavaFX support.
JavaFX is available for many Java VMs. There are JavaFX runtimes available for (at least) the following platforms:
OS X, Windows, Linux, iOS, Android and various embedded architectures.
JavaFX download and source locations:
Binaries for some JavaFX runtimes (such as OS X, Windows and Linux) are provided by Oracle based upon Oracle JDK sources.
Binaries for some other runtimes (Android, iOS and embedded architectures) are provided by Gluon based upon Open JDK sources.
Binaries for Debian based Linux systems are in the Debian Package Tracker, based upon OpenJDK sources.
Open source code is available to build JavaFX for use with other platforms and Java VMs as part of the OpenJDK project.
For further information, see related questions and resources:
OpenJFX wiki site for open source JavaFX information.
What's the location of the JavaFX runtime JAR file, jfxrt.jar, on Linux?
JavaFXPorts: JavaFX to mobile and embedded hardware, including iPhone, iPad, Android devices, and the Raspberry Pi.
Java FX 2 on IBM jdk?
Certified configurations for JavaFX when running with Oracle Java 8 (Windows, OS X, Linux).
JavaFXPorts enables execution of JavaFX on the Android runtime natively and, currently via RoboVM, on the iOS runtime, for more info see: JavaFXPorts, how it works.
can I install it or bundle it with my application?
Yes.
Oracle JavaFX and OpenJFX distributions ship with tools for bundling JavaFX (and an appropriate Java runtime) with your application.
Gluon provides tools for packaging JavaFX applications for iOS and Android.
The JavaFX maven plugin supports bundling via a Maven based toolchain.
The JavaFX gradle plugin supports bundling via a Gradle based toolchain.
In terms of licensing for such distributions, I encourage you to do your own research.
Oracle Binary Code License (if you are bundling Oracle JRE).
OpenJDK Legal Documents (if you are basing the bundled components off of OpenJDK).
It became integrated partially in Java 7 and more tightly in Java 8 so it should be standard in newer VM's and is slowly opening up. However, I wouldn't consider migrating from Swing to FX as a move up as much as a lateral move as explained here.
IBM provides their own version of Java, and as far as I have ever seen, they do not seem to provide JavaFX in their runtimes for whatever reason. I have only seen JavaFX provided by the canonical Oracle releases.

Javafxpackager: how do you set the "base JDK"?

When I run javafxpackager, I get the following warning/info:
No base JDK. Package will use system JRE.
It's not clear from the docs for Deploying JavaFX Applications how one would specify an alternative JDK. There isn't an option for it, that I can see (maybe I'm blind). Is it a system property?
Thanks.
There is an old Oracle blog which mentions this. Don't know if it is still applicable or relevant to your case or not though:
Self-Contained Applications: Select Java Runtime to bundle
Packager tools in 7u6 assume current JDK (based on java.home property)
is the source for embedded runtime. This is useful simplification for
many scenarios but there are cases where ability to specify what to
embed explicitly is handy. For example IDE may be using fixed JDK to
build the project and this is not the version you want to bundle into
your application.
To make it more flexible we now allow to specify location of base JDK
explicitly. It is optional and if you do not specify it then current
JDK will be used (i.e. this change is fully backward compatible).
New 'basedir' attribute was added to tag. Its value is
location of JDK to be used. It is ok to point to either JRE inside the
JDK or JDK top level folder. However, it must be JDK and not JRE as we
need other JDK tools for proper packaging and it must be recent
version of JDK that is bundled with JavaFX (i.e. Java 7 update 6 or
later).
Here are examples ( is part of task):
<fx:platform basedir="${java.home}"/>
<fx:platform basedir="c:\tools\jdk7"/>
Hint: this feature enables you to use packaging tools from JDK 7
update 10 (and benefit from bug fixes and other features described
below) to create application package with bundled FCS version of JRE 7
update 6.
When run with the parameter -Bruntime:
javapackager.exe -Bruntime="c:\Program Files\Java\jdk1.8.0_76\jre\" ...
you get the following info:
Using base JDK at: c:\Program Files\Java\jdk1.8.0_76\jre
In case it helps anyone, I wanted to use javapackager to bundle the 32-bit Java 8 JRE. I was running into issues because the JDK was the 64-bit Java 8 JDK. I was able to solve my issue by setting JAVA_HOME to the 32-bit JRE.
I have just solved same problem:
NetBeans ID - Tools - NetBeans Platform Manager - "Sources" tab
button Add ZIP/Folder
(there were no sources set so I set it and "No base JDK. Package will use system JRE."
disappeared)

Java and Eclipse - 32 vs. 64bit

I'm a little bit confused about the two different versions of Eclipse - 32/64bit.
As far as I know, Java bytecode (= build of your code) is platform independend. If a user runs your bytecode in a 32bit JRE, the code is executed in as a 32bit process, if a user runs your bytecode in a 64bit JRE, the code is exectued as a 64bit process.
Eclipse needs the JRE to run, cause it's written in Java. But why are there 32 and 64bit versions of Eclipse on the Eclipse download page if only the user's JRE version does matter?
Does a 64bit Eclipse version need a 64bit JRE or JDK? If yes ,why?
Second confusion: I understand the need for a 32 and 64 bit version of the JRE. But why are there 32 and 64 bit versions of the JDK if the resulting bytecode is platform independet?
Thank you
Eclipse relies on SWT, which is essentially native code. There will be quite a few DLLs etc. exists (in the plugins or features directories) that will be used by the 64-bit version, that are drastically different from the 32-bit version.
It is not because of the running environment, it is because Eclipse uses some native stuff and must be run on corresponding JDK. The applications you are developing inside Eclipse can then be run on whatever JRE you have installed, just specify it in the settings.
JDK is a compiler and also a lot of other stuff. Many of them are native applications that need to be run corresponding platform.

JDK/JRE/JVM/Java SDK | What do they all mean? Sometimes you can develop with JRE and sometimes you need JDK?

To tell the truth, I am quite confused on all these terms (JDK/JRE/Java SDK). I am not sure what each one does.
When I first started doing simple java examples in eclipse, I am pretty sure I only had the JRE, which I believed was the default java installer regular users use to be able to run java programs/applets on their system.
However, now in class we are using Google Appengine, and this requires the JDK which I am guessing is the same as Java SDK. After wasting some time finding out that installing the JDK meant I also had to add java/bin to the environment variables to get javac -version to work in the command prompt I find that only the JDK has javac...
How were my early java programs working without having installed the JDK and therefore not having javac? And really the main question... What is the difference between the JRE and JDK, and when do you use each one?
Thank you :)
JRE = Java Runtime Environment - what you need to run programs/software that require Java or use libraries written in Java. For example, OpenOffice requires the Java Runtime Environment
JDK/Java SDK = Java Development Kit/Java Software Development Kit - what you need to write programs that require Java or use libraries written in Java. For example, if you were to write your own word-processing tool in Java.
java comes with the JRE because it launches the VM (virtual machine). It can take in class files which are files that have been compiled using the JDK.
The JDK comes with javac because that's what you need to compile your .java files into .class files that can then run on the JRE.
Eclipse has its own built-in compiler (called ecj), which is probably the reason you could get away with not having the JDK installed to use it. It does not use javac.
Google App Engine uses the javac that comes with the JDK.
What is the difference between the JRE and JDK and when do you use each one?
JRE: Java Runtime Environment. It is used to run Java programs only. As Chris Jester -Young mentioned, Eclipse had a built in compiler. That's why you just needed JRE ( to run eclipse )
If you ship a Java program, the only thing the client need to have is this runtime environment
JDK: Java Develpment Kit, this also includes a JRE inside, but additionally have other tools for program development such as the java compiler javac among many others.
If you want to create java program you should use this.
There's no way you used the JRE to compile Java programs. javac, the Java compiler, only comes with the JDK.
You may write Java programs with whatever text editor, you don't need anything special to do this.
You need the JRE to run Java programs. The JRE includes the Java Virtual Machine, needed to run already compiled Java programs.
You need the JDK to compile Java programs. So if you are a Java developer, you may want to only install the JDK since it comes with the tools needed to compile, in addition to the Java Virtual Machine.
'Sometimes you can develop with jre'
No. Never.
You develop with the Java Development Kit. You run with the Java Runtime Environment or Engine or whatever it's called.