I'm new to Java Swing & I'm a bit stumped. The application I'm developing will be installed on systems that have not installed JRE. Is there any way to pack JRE inside the Java Swing application and create an EXE file which installs JRE and the application?
Use deployJava.js to ensure a suitable minimum JRE is installed on the computer of the end user. Then use Java Web Start to install and launch the application itself.
Both of those are:
Supplied by Oracle for deployment of rich client apps.
Designed to work on Windows, OS X & *nix.
You can create .exe files from your Java program source using Launch4J. This tool offers an option to set up a relative path to a Java JDK/JRE. This means you could deliver your software with the needed JDK/JRE.
But be carefull. I think you get in trouble if you offer a JDK/JRE for download due to licensing issues.
Best way is to tell the users to install JDK/JRE themselves....
You have to use an installer for that. Try NSIS for instance
Related
I would like to know if it is possible to configure the Java VM used by Eclipse to run in this way, that it uses JavaFX SDK libraries.
Please be aware! I don't want to build JavaFX applications on my own in Eclipse, e.g. by using E(fx)clipse or other plugins.
Another remark: I don't use Java development perspective in Eclipse or a Java project. So it won't work to add the external .jars of JavaFX as user libraries!
In my use case I have an third-party GUI application based on JavaFX that has to be started out of Eclipse.
If I try to start this application I receive the following error:
The system reqirements are not met.
Could not find: javafx.properties
in:
/Applications/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.macosx.x86_64_17.0.2.v20220201-1208/jre/lib
Your Java Virtual Machine seems not to support JavaFX,
required to run the XXX.
Please make sure you provide a valid path to the Java FX
modules during gui installation.
As you can see by the error message my Eclipse runs on a MacOS x64 system.
But I think the way to configure the VM of Eclipse should work on each system the same way.
Thank you.
Steve
If you have a third-party GUI application, then you do not need an IDE like Eclipse.
Ideally the publisher of your app would have provided the app as a package that includes the JavaFX/OpenJFX libraries as well as all the parts of a JDK/JVM needed to run that app on your Mac.
If the publisher gave you only the bare-bones app without the needed libraries & JDK/JVM, you can obtain a JDK/JVM bundled with those libraries.
At least two vendors supply a JDK with JavaFX/OpenJFX libraries:
ZuluFX by Azul Systems
LibericaFX by BellSoft
Both are available free-of-cost with optional support plans available for sale. Download either product as an installer specific to your Mac, while paying attention to either Intel-based Mac or Apple Silicon (ARM, AArch64) based Mac.
You can verify the install by using a console such as Terminal.app to run:
java --version
… and:
which java
You can also use the Finder to locate your installed JVMs by choosing Go > Go to Folder… where you paste:
/Library/Java/JavaVirtualMachines
If your app contains the necessary MANIFEST.MF file, you may be able to launch your app by double-clicking. If not, use a console such as Terminal.app with the java command to launch the app.
I make a java application I want to make the setup file save in the USB. Firstly the installation process will check is JDK or JRE is installed or not and then proceed further installations.
Is there any tool or anything way please guide me.
You can create a standalone installer with Self-Contained Application Packaging.
According to the documentation you can create packaged application in one or more of the following deployment modes:
As a standalone application, using the system
As a self-contained application, using a private copy of JRE
As a Java Web Start application, using the system JRE
Embedded in a web page, using the system JRE
I am rather new to programming and have begun designing a text-adventure game in Java. I am currently having difficulty finding out how to make the text-adventure playable on machines that don't have a JRE such as BlueJ or Eclipse installed. I would like to share my game with friends but don't want to install the JDK and a JRE for them to play it.
Thanks for the help in advance.
1) Using Java Web Start
Java Web Start software provides the power to launch full-featured applications with a single click. Users can download and launch applications, such as a complete spreadsheet program or an Internet chat client, without going through lengthy installation procedures.
2) The Java Packager Tool (For Java 9)
The Java Packager tool can be used to compile, package, sign, and deploy Java and JavaFX applications from the command line. It can be used as an alternative to an Ant task or building the applications in an IDE
3) Wrapping Java to EXE
Multi-platform tools can generate native installers for multiple platforms —
Windows, OS X, Linux
Advanced Installer for Java
install4j
InstallAnywhere
JWrapper
IzPack
InstallShield
Terminology
JDK
This is the Java SE Development Kit, which contains all of the JRE and also tools for building java programs.
JRE
This is the Java Runtime Environment, which only had the bits needed to run java programs
IDE
This is the Integrated Development Environment, which only the developer needs, such as Eclipse, BlueJ or IDEA.
What do users need
To run a JAR or class file the user needs:
Any dependencies that the program needs
Either a JDK or a JRE
Using JLink
You can use JLink to make a small version of the JRE, with only the packages which your program needs to run, reducing the install size, this can then be packaged with your game.
Advantages
Smaller than a full JRE
Faster to load
Disadvantages
If lots of apps have their own JRE then space may be wasted
You will need to update the JREs individually if an update happens
I have a friend without java. I want to package my executable .jar file with java platform SE binary in an exe file so he can run it without downloading the entire java runtime. Could someone point out some kind of software that does that?
I have a friend without java.
And you call them a friend? ;)
Use deployJava.js to check the user has the minimum Java required to run the app.
Install & launch the app. using Java Web Start.
Give the user a link to the 'launch' web page.
This will work on Windows ..and OS X ..& *nix.
Try using Launch4J at http://launch4j.sourceforge.net/
Here's the highlights:
Launch4j wraps jars in Windows native executables and allows to run them like a regular Windows program. It's possible to wrap applications on Windows, Linux, Mac OS X and Solaris!
Also creates launchers for jars and class files without wrapping.
I have also had good experiences with Launch4j. Also check out JSmooth: (http://jsmooth.sourceforge.net/index.php) which claims to have an option to download and install a JVM if one is not available.
I make my executable jar in exe format, but I want to add JRE with this because if JRE is not present in their machine, they can use it with this included JRE.
But I do not want to install this JRE in their machine. This JRE is only used by this application only. It will just like game or other application. I use launch4j to make jar to exe but i did not find any option from where it can attach JRE and it has no option from where I can link my jar dynamically.
How do I achieve that?
If there is other free installer then mention it, and please give the procedure with example.
Since it has been established that your app. has a GUI, I will suggest Java Web Start as the answer.
But I do not want to install this JRE in their machine.
That is not a sensible requirement. The user might already have a usable JRE installed, if they don't they probably also don't want every Java based application to be installing its own 'private' JRE.
Oracle's deployJava.js can do the checking, and help guide the user through the steps of installing (which basically comes down to click 'OK' when prompted).
I make my executable jar in exe format,..
If you only intend to support Windows, what is the attraction of coding in Java? JWS supports any platform for which Java is available. That brings a lot more potential customers for the app.
I want to use free installer.
JWS is entirely free. Just like the JRE.
..please give the procedure with example.
Do you run an IDE? If not, do you otherwise have Ant installed? If that is a yes to either one, check out my small JNLP API examples. Each comes with complete source and a build file (an Ant build.xml).
Within a couple of keystrokes & a few moments, you can see the app. installed and launched on your desktop. For the end user, it is even simpler. Just click a link in a web page, and it all happens automatically (possibly with a security prompt - for the protection of the user).
I like JSmooth. You can give it a try here:
http://jsmooth.sourceforge.net/features.php
Flexible automatic Java VM detection
Detects the location of any Sun JVM installed. The wrappers use
several strategies to detect all the JVM available on a computer,
using windows registry, environment variables, windows path.
Detects
and uses Microsoft's JView (for 1.0 and 1.1 Java applications), if
available.
The JVM search sequence is fully customizable using the
GUI. You can force the executable to search in the path first, and in
the registry last, or in JAVA_HOME first. We have all the flavours!
Sometimes it's more convenient to bundle a JRE with your application.
JSmooth can deal with that too, you just need to define in which
folder the JRE is expected. It falls back nicely to a standard JVM
search if the JRE is not where it should be.
Specify which versions of
the JVM are compatible with your software. You can set a minimum
version, but also a maximum JVM version.
Documentation: http://jsmooth.sourceforge.net/docs/jsmooth-doc.html
Take a look at launch4j.
I had to use it, and it worked out very well.
You can set a minimum version of a needed JRE, bundle a JRE, or if a JRE is not found (and not bundled) the launcher may lead the user to a download location of an appropriate JRE.
There are various further features launch4j offers, and as opposed to another suggestion here, launch4j is activly developed
http://launch4j.sourceforge.net/