I have made sample application with JavaFX using netbeans 7.2. When I run application from netbeans it is working fine. Now I want to distribute this application as the standalone application.
So I am trying to opening this application from the executable jar file made by netbeans itself in the dist folder. But I am getting error : Unable to Load JavaFX runtime
How to resolve this issue ??
Also I wanted to know the best way to distribute this application as desktop standalone application ? Means I wanted to know the final package for distribution would it be executable jar file ?
For this final package(suggested for above question) will there be any prerequisites for the application to run on windows environment ? : This is importance because our final environment is very limited. It don't have even java installed on it.
I don't know why launching the executable jar created by NetBeans does not work for you.
You can workaround this issue by packaging your application as a Self Contained Application. Such a package includes the java and javafx runtimes with your application so you never need to worry about distribution and installation of these things to your client. In any case, it sounds like such a package is a good fit for your application.
A self-contained application is a wrapper for your JavaFX application, making it independent of what the user might have installed.
Related
I am attempting to build an application in NetBeans that can be deployed to and end user. I am still pretty new to deploying projects and this is by far the most complicated one I have done so please bear with me. I currently have a working application in NetBeans which utilizes JDK 15 and JavaFX 15. As long as I run things inside of NetBeans everything works as intended. I have reached a point where I want to make sure I can distribute this application outside of NetBeans. To this end I did some searching and found the following tutorial.
https://netbeans.org/kb/articles/javase-deploy.html
I was able to follow the tutorial and build the example. The build works in NetBeans, I am able to run the executable jar file in the dist folder from the command line, and I am able to run the jar file by executing it from the file explorer. Now when I attempt to do the same process with my own project I run into the following errors.
When I attempt to run the jar file in the dist folder absolutely nothing happens.
When I attempt to run the jar file from the command line using the command
java -jar "C:\Workspace\HandyAndyVersion1_2\dist\HandyAndyVersion1_2.jar"
I receive the following error,
Error: JavaFX runtime components are missing, and are required to run this application.
I am currently under the assumption that the first problem is a by product of the second. If anybody has a solution to this problem or any ideas on what I could have configured wrong please let me know and thank you all in advance.
To package a Java desktop application these days, you should be using the jpackage tool and optionally the jlink tool. These will generate a JRE image that is packaged with the application and contains the modules you need.
I suspect the issue you are running into is that the native libraries for JavaFX are not present. Most distributions of JDK 15 do not contain the JavaFX modules, though some do. (See the Full and FX bundles of the JDK from Azul and Bellsoft). I find it is easier to use a JDK with JavaFX bundled rather than have to manage a separate module path during development for the jmod files of JavaFX, but that is another option. Either method can be used with jlink to create a suitable JRE for your application that includes the JavaFX modules.
we have developed GUI tool using Java SE 11 , packaged using Maven. Recommend user to download and set Java in system path to launch the tool. Batch file for windows and .command file for Mac and Linux. Do we need to get notarize approval from apple to use it in Mac OS. Please advice
Thanks
You don't need Notarization for the script files. For your GUI Tool it highly depends on your projects dependencies. If your project only use common java packages, then everything should be fine. But there are libaries which require notarization. I personally had this issue with the net.java.dev.jna dependency. My experience is based on a jar bundled within an application. I am not sure if it is the same for a jar excuted from a script only. I recommend to just build your app and try to run it on a catalina machine.
I am working on a large JavaFX application which is due for deployment. I want to wrap the .jar files with Launch4j and create an installer using Inno Setup. However, I am having trouble with the process.
When using Launch4j, it spits out these errors (see 1). However, despite these errors, everything works perfectly fine using an MWE I created to verify that Launch4j wraps jar files properly. The MWE is just a small JavaFX application, where I use Launch4j to generate an .exe file and use Inno Setup to generate an installer. I can install this MWE with no issues using the generated installer and run the app. As mentioned, however, when I follow this exact same approach for my large application, which does have a lot more dependencies, I am not able to run the application after using the generated installer.
I searched for solutions to this and found this work-around using Inno Setup (see ban-geoengineering's answer):
How do I bundle a JRE into an EXE for a Java Application? Launch4j says "runtime is missing or corrupted."
I followed the steps mentioned but am still not able to run the application after generating the jar wrapper with Launch4j and running the generated installer created by Inno Setup. When I try to run the app, simply nothing happens.
Application information and development environment
The application utilizes custom-made java libraries developed in-house which act as an intermediary to communicate with a device's eSW through a custom interface. These java libraries and device drivers are needed in order to communicate with the device and need to be delivered with the application, as in included with the installer. I am using IntelliJ IDEA 2018.1 under Windows 10 Enterprise. The JDK is version 9.0.4.
Steps taken prior to using Launch4j and Inno Setup
I have followed the steps mentioned here https://www.jetbrains.com/help/idea/creating-and-running-your-first-java-application.html#package to package the application. I can successfully run the application via the commandline using java [options] -jar nameOfJar. The application needs certain VM options in order to communicate with the device drivers, and I am suspecting the issue lies here when generating the .exe file and generating the installer.
Addition 1
I have tried to add a custom classpath in Launch4j. It seems that Launch4j does identify the jars that the main class is dependent on, as it includes all the proper jar files (see 3).
I have in addition to this tried to mimic the JVM options I use to run the application via the commandline (see 4).
When executing the application it spits out NoClassDefFoundError and says it is due to the com/demant/gearbox/corona/model/GBCManager. However, this should already be included via the jar file com.demant.gearbox.corona.model.jar, as you can see in 3.
But, as you can see from both 3 and 4 the NoClassDefFoundError is still thrown.
High level: I am working on a JavaFX app that I'd like to automatically update
Things I've looked at:
Add ability to automatically update co-bundled app (Open JDK official auto updater issue)
UpdateFX (Library for handling automatic updates)
Issue I am having: Trying to package two separate javafx native executables into one package.
Description:
I have created a JavaFX UI application that checks for an updated version upon startup. The application is delivered by building a native (using jfx packager) package for each OS: Liux, Windows and OSX.
If there's a newer version available the app downloads the required update into a temporary folder.
To update itself, the app technically needs to overwrite some of its own files. While this is possible to do on Linux and OSX, Windows locks all of the jar files that I need to update while the main application is running.
To get around this, I created a small "updater" application that I would download. My main application would download all of the updates AND the updater application. The main application would then launch the updater and kill itself.
The updater would continuously try to update that application files (this was in some kind of loop in case it took a while for the main application to shut down).
Once the updater would finish, it would simply call the correct main program's executable file and the update would be completed.
This works...BUT: In order to run my updater application, I am relying on the client's machine having java (and having the correct version to boot). The whole point of using the javafx native packager is to make sure that the JRE is distributed with the app and that there is no dependency on any local version.
I wanted to try a hack:
Instead of having my updater be a regular jar (java application). I could make the updater be a JavaFX application that I package natively.
I'd then manually take the generated native executable out of the updater and just distribute it with my main application.
Since the folder structures for both main executable as well as updater executable would be the same, I was hoping that both executables could piggy back on one bundled JRE
The hack only works on OSX - on both windows and linux there are local config files that the executable relies on to invoke the correct java file.
Is there any way to get around this issue? Is there any way to force the packager to output a custom "package.cfg" (in the case of windows) that would allow me to bundle two executables?
I realize this is a long shot, but any advice would be appreciated.
I may have asked my question just a bit before the code to do what I wanted was included in javapackager.
Short story is that this is now possible to do using javapackager that is part of JDK 1.8 release > 60 (I am now using 74)
Here's a link to the official oracle documentation: Oracle Doc
It's also possible to use Maven to build your JavaFX app to have secondary launchers via: javafx-maven-plugin
Is it possible to create a standalone, executable JAR that uses JavaFX for it's GUI?
I want to create an application and send it to a friend that has only the JRE 6 installed.
Please note, that the solution has to be compatible with either Maven or Gradle.
JavaFX has support for creating standalone native packages.
See https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html#BCGIBBCI