how to bind java setup with my application setup? - inno-setup

i am beginner in java. i have done one application using java swing. Now i want make a setup or installer of that application.
i have been trying install4j for .jar to .exe file and "inno setup compiler" for setup and it run successfully. but problem is that this setup run on machine where java is not installed but the application is not running and generate error for the java runtime environment is not installed.
how i can install java with my application on machine of the user of my system

In install4j you need to configure your installer either as static bundle or as a dynamic bundle. A static bundle will ship the JRE with the installer and the dynamic will download the JRE at installation time.
From the help page:
Static bundle
The selected JRE will be distributed in your media file.
Dynamic bundle
A dynamic bundle is downloaded on demand. If the user already has a suitable JRE installed, that JRE will be used. If there is no such JRE available on the target machine, the installer will download the dynamically bundled JRE from the URL that you specify in the text fields below.

Related

Maven to create linux suitable build in windows OS

My development environment is windows. When I package a jar in my maven project, the variable {user.home} is being replaced with the appropriate windows path (C:\users\MyUsername\).
Then, before I distribute the jar to my linux server, I manually change the path to the linux equivalent.
Is there a way to force maven to build the jar suitable to linux deployment while I'm working on windows OS?

What's the location of the JavaFX runtime JAR file, jfxrt.jar, on Linux?

I'm trying to run some JavaFX code with Eclipse Kepler, with e(fx)clipse plugin installed, on a Linux machine, using:
java version "1.7.0_21"
OpenJDK Runtime Environment (IcedTea 2.3.9) (7u21-2.3.9-5)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
My understanding is that although JavaFX has been included with the standard JDK since version JDK 7u6, the JavaFX runtime JAR file, jfxrt.jar, was left off of the Java runtime path on purpose until further testing between JavaFX and rest of the java infrastructure has been completed. For this reason you must manually add it to the project build path libraries when we create a new Java project.
I've been looking for that jar in both the following directories without success:
/usr/lib/jvm/java-7-openjdk-common/jre/lib/
/usr/lib/jvm/java-7-openjdk-amd64/lib
Where else should I look for it?
Update March 2021
The previous information in this answer is now obsolete for later versions of Java and JavaFX (e.g. Java 11+). This update provides info for more recent versions.
JavaFX is now available from openjfx.io or the public Maven repository as an SDK or a library set, or a module set. JavaFX has been partitioned into a set of dependencies rather than a monolithic jfxrt.jar library distributed with the Java runtime (as was previously the case with Oracle Java 8 for instance).
With versions 11+ of JavaFX, the location of the JavaFX jar files (and the native libraries to accompany them) will depend on how you build your project. For example:
If you use a build tool such as Maven or Gradle and specify JavaFX as a dependency, then the JavaFX jar files will be downloaded into your local Maven or Gradle repository (the same as other maven dependencies).
If you download the JavaFX SDK from openjfx.io (gluon), then the JavaFX jar files will be in the location you unzipped the SDK to.
The location of jfxrt.jar in Oracle Java 7 is:
<JRE_HOME>/lib/jfxrt.jar
The location of jfxrt.jar in Oracle Java 8 is:
<JRE_HOME>/lib/ext/jfxrt.jar
The <JRE_HOME> will depend on where you installed the Oracle Java and may differ between Linux distributions and installations.
jfxrt.jar is not in the Linux OpenJDK 7 (which is what you are using).
An open source package which provides JavaFX 8 for Debian based systems such as Ubuntu is available. To install this package it is necessary to install both the Debian OpenJDK 8 package and the Debian OpenJFX package. I don't run Debian, so I'm not sure where the Debian OpenJFX package installs jfxrt.jar.
Use Oracle Java 8.
With Oracle Java 8, JavaFX is both included in the JDK and is on the default classpath. This means that JavaFX classes will automatically be found both by the compiler during the build and by the runtime when your users use your application. So using Oracle Java 8 is currently the best solution to your issue.
OpenJDK for Java 8 could include JavaFX (as JavaFX for Java 8 is now open source), but it will depend on the OpenJDK package assemblers as to whether they choose to include JavaFX 8 with their distributions. I hope they do, as it should help remove the confusion you experienced in your question and it also provides a great deal more functionality in OpenJDK.
My understanding is that although JavaFX has been included with the standard JDK since version JDK 7u6
Yes, but only the Oracle JDK.
The JavaFX version bundled with Java 7 was not completely open source so it could not be included in the OpenJDK (which is what you are using).
In you need to use Java 7 instead of Java 8, you could download the Oracle JDK for Java 7 and use that. Then JavaFX will be included with Java 7. Due to the way Oracle configured Java 7, JavaFX won't be on the classpath. If you use Java 7, you will need to add it to your classpath and use appropriate JavaFX packaging tools to allow your users to run your application. Some tools such as e(fx)clipse and NetBeans JavaFX project type will take care of classpath issues and packaging tasks for you.
Mine were located here on Ubuntu 18.04 when I installed JavaFX using apt install openjfx (as noted already by #jewelsea above)
/usr/share/java/openjfx/jre/lib/ext/jfxrt.jar
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jfxrt.jar
On Ubuntu with OpenJDK, it installed in /usr/lib/jvm/default-java/jre/lib/ext/jfxrt.jar (technically its a symlink to /usr/share/java/openjfx/jre/lib/ext/jfxrt.jar, but it is probably better to use the default-java link)
The location of jfxrt.jar in JDK 1.8 (Windows) is:
C:\Program Files\Java\jdk1.8.0_05\jre\lib\ext\jfxrt.jar

Why do I need Java installed to install the JavaEE6 SDK?

New on Linux, I try to install the JavaEE 6 SDK, first step to install GlassFFish:
http://www.oracle.com/technetwork/java/javaee/downloads/java-ee-sdk-6u4-jdk-7u11-downloads-1900532.html
When I run
sh java_ee_sdk-6u4-jdk7-linux-x64.sh
on my server, I get prompted that I should have Java installed:
Could not locate a suitable jar utility.
Please ensure that you have Java 6 or newer installed on your system
and accessible in your PATH or by setting JAVA_HOME
This is where I am confused:
is it the Java from the JDK package? But I am in the process of installing it, so of course I don't have it installed yet!
is it the Java from the JRE then? Should I install it first (and set up the environment variables etc.)?
Thx for any clarification!
In order to use any java code, including Java Development Kit, JDK, you'll need to have Java Runtime Environment, JRE. Most of the JDK package comes with JRE. JRE contains API to run Java classes.

How to run .exe file converted from .jar file using Launch4J tool without Jre

I converted my jar file into .exe using Launch4J. Now as per my need I have to run this exe file on system with no JRE installed. Is it possible to run .exe file converted from jar file without JRE or is there any way to embed JRE with the .exe file?
the exe is just a facility to run the program on windows, it is also needed the JRE.
[]'s
I think you don't need JRE for running a .exe file.But if you create a .exe file from a jar file, you should have JAVA in your system or in any other PC you want to run the .exe file. So JRE comes with the JAVA when installed(only basic thing). I think you can include JRE by using launch4j. I used it long back ago. But I won't personally recommend it. I always use Jar2EXE for converting the jar file to an .exe file.
it's not possible to run the exe without JRE (since the exe is just wrapper of jar)
I would suggest you to use a setup tool to create an Installer. It's the easiest way. Launch4j is not capable of putting JRE into exe, so you would have to send 2 parts (exe + JRE). However if you create an Installer, you'll have just 1 exe file where you have packaged everything. I'd recommend Inno Setup Compiler.
I don't know with Launch4J.
But you can do it with NetBeans and a couple of tools. The result is a standalone installer that packages everything you need (included java files), so your software can run without installing JRE. But in the end it does need JRE to run, only that everything is included, and it's totally portable.
here is this solution

javafx deployment using java 6

I just package my JavaFX app using the provided tool. But when I try to run it using java -jar app.jar I get a message asking me to install a newer Java version. I'm using 6u33 withfx 2.2beta` in development environment and is running fine. So, my question is, what is the required config to run under Java 6?
Here is my package command:
\javafx-sdk2.2.0-beta\bin\javafxpackager.exe -createjar -appClass gui.principal.FrmPrincipal -classpath lib\jfxrt.jar;lib\antlr-2.7.7.jar;lib\dom4j-1.6.1.jar;lib\hibernate-commons-annotations-4.0.1.Final.jar;lib\hibernate-core-4.1.4.Final.jar -srcdir classes -outdir dist -outfile Etransporte.jar -V
Thanks!
Well, a couple of hours later I downloaded the final version of JavaFX SDK and installed it over my Java 6u33 SDK and everything worked fine since then. So, upgrade is the rule.
No need to use the beta sdk, use the production sdk. The beta sdk may have unresolved bugs and is not suitable for packaging applications for general deployment.
Just some general info, I think you probably have most of this covered already, but something might be useful.
Here is a sample batch script for packaging a javafx application with javafxpackager.exe. Offhand the command you are running looks fine.
Ensure that the java system and javafx installation on your test machine are both the same bit architectures (e.g. 32bit or 64bit). Also jre6+javafx2.2 is only supported on Windows machines, not Linux or Mac.
Note that if your client machine only has jre 6 installed and not the JavaFX runtime, then it is expected when you run your packaged app on that system that it will provide some prompt and help to allow the user to install the JavaFX runtime on the client.
Also note, that not all versions of jre6 are supported by JavaFX 2.2, it must be a recent version of jre6 (2.2 requires Java SE 6 Update 33). It does seem that you are running the right minimum version.

Resources