I want to make a executable file of my project which I made in JavaFX 2.0. Can anyone help me with this?
The JavaFX team implemented support for this in the tools bundled with the JavaFX 2.2 SDK (included in Java7 from update 6). The JavaFX packaging toolset for packaging executables is documented in self-contained application section of the JavaFX deployment guide.
See RT-19446 "Add ability to co-bundle Java + JavaFX + App into a single native executable" for more information (anybody can sign up to view the jira).
3rd party tools such as the JavaFX maven plugin or the JavaFX gradle plugin, streamline integration of building native JavaFX executables using common build systems.
The JavaFX packaging tools can also be used to natively package any Java application, not just JavaFX applications. For example, a Swing application, as demonstrated by this shell script for packaging a Swing application using JavaFX on OS X.
If you want to do the packaging for the 2.0 or 2.1 versions of JavaFX (not JavaFX 2.2+), then you should review Packaging JavaFX Applications as Native Installers.
Javafx 2+ can now easily be packaged as a native exe (with an added payload, which the current JRE), the up to date (as in the end of 2012) article is here: http://docs.oracle.com/javafx/2/deployment/self-contained-packaging.htm
Out of curiosity I created an executable on Windows (copy-pasting the netbeans build code into netbeans' build.xml) from the canvas and the hello world examples: the app is around 20k, the executable/launcher is around 80k and the added runtime is 138mb.
By the way if you have an older netbeans install (installed with a pre 1.7jdk) you may have to update it or edit its netbeans.conf fixing the "netbeans_jdkhome" path, otherwise the bundled executable's packaging may fail.
There are several tools to generate a customized exe launcher for your Java application.
I have good experience with Winrun4J: http://winrun4j.sourceforge.net/
but you will always need an installed Java/JavaFX Runtime even if you have an .exe that contains all your code.
Related
I wanna export my app to PC and Android devices. If i create a JavaFX project with sdk 13.0 and try to export as a JavaFX application it says fx:deploy not supported. So i tried gluon plugin. But when i open a project i cant run even the empty scene. I found one tutorial on the internet how to do that, but he had inside the build.grandle some long settings, and i have only one line
apply plugin: 'base'
And i get this error every time
The project uses Gradle 4.3.1 which is incompatible with Java 10 or newer.
What is the easiest way to export java app to exe or apk ?
Creating an installer for the desktop platforms (Windows, macOS, Linux) has become easy these days. The tool of choice is jpackage which started to be shipped with JDK 14. It can either be used on the command line on the finished project or you can use a Gradle plugin (https://github.com/beryx/badass-jlink-plugin). If your project is not modularized you could follow this tutorial https://github.com/dlemmermann/JPackageScriptFX which also uses jpackage but together with Maven and some other tools from the JDK. The Maven part could easily be rewritten to Gradle, if needed.
Building for Android or iOS is another story. You will need the Gluon client-gradle-plugin (https://github.com/gluonhq/client-gradle-plugin) to do that. But I think it is rather naive to believe that an application which is written for the desktop can be used one to one on a mobile platform. Technically this would work for a hello-world like demo but not for a real application just because your environment, the form-factor and many other things are just different. So you will have to adjust your project to accommodate for that.
According to this oracle docs there is a conventional java app packaging along with runtime JRE. (Self-Contained Application Packaging)
I know that there is this thing (Launch4j gradle plugin) but I'd prefer to have a bat/sh executables along in the package.
Going through gradle docs and googling I can not seem to find is there is a way to teach gradle to package desktop app with JRE. Is there?
Have you tried this plugin yet?
https://github.com/FibreFoX/javafx-gradle-plugin
This has been a while ago, but if you're still looking for packaging Java desktop apps, have you tried Hydraulic Software's Conveyor?
https://conveyor.hydraulic.dev/
It's a commercial app, but it's free to use for Open Source projects.
I am attempting to create a NetBeans Platform Application int NetBeans 8.1 that can use Maven but a different Platform from the regular Development IDE. I've already added the platform I wish to use by going to Tools -> NetBeans Platforms -> Add Platform and it registered correctly with the IDE.
I can then use this platform to create a new NetBeans Platform application with the added platform as the base, but when I try to create a NetBeans Application by going under the Maven category only various versions of NetBeans are available. I'm still getting used to the environment but I'm pretty sure that it only shows these versions because it pulls those platforms from the repositories.
My question is there some way to create a Maven NetBeans Platform application with a third party Platform? If not possible to do that how would one go about adding the third party platform to a Maven NetBeans Platform application?
with maven based apps, you don't deal with the Tools -> NetBeans Platforms UI, you declare platform artifact versions in the maven pom files.
I have created a desktop application using javafx. It uses the database of mysql. And by using Netbeans I packaged the application into running jar.
Now I want to distribute the application as a exe file for the windows users. Now my problem is how to create exe file from the jar and how that exe will connect with the database.
There is an official Java Packager Tool which is part of the JavaFX suite. It can create self-contained applications including a native launcher: .exe on Windows, .app bundle on OS X, etc. By default it bundles a JRE as part of the application, but this behavior can be changed to use the system JRE instead if desired.
You can call the Java packager via Ant tasks, the javapackager command line tool, or using the NetBeans IDE. See the Java deployment guide for details.
exe4j or install4j may be a good option
Disclaimer: I work for Excelsior.
We've just discovered that Excelsior JET seems to already support JavaFX 2. You can compile your JavaFX app down to native code with it, as opposed to (launch|exe|install)4j that are only capable of creating EXE launchers and wrappers.
That said, a launcher/wrapper generator may be a better fit for your needs and budget.
This installer will first check if jvm is present on the system or not. If not then it will first install the jvm. After that it will include the java code (may be in jar) alongwith the database used. And finally it will create a desktop shortcut and make changes to registry as other s/w does.
First you need to decide on a setup authoring tool. Here is a list which can get you started:
http://en.wikipedia.org/wiki/List_of_installation_software
Advanced Installer is one of the tools which has a dedicated Java project type.
To detect and install JVM, you can add it as a prerequisite. This is done differently for each setup tool.
There is a new tool being developed for that: jpackage
If your project is build using Gradle then you can easily use the Badass jlink plugin: https://github.com/beryx/badass-jlink-plugin
to build an installer / package using jpackage
Here's an article how to build an app image using OpenJDK 11 and using OpenJDK 14 with jpackage only for building the installer / package:
https://walczak.it/blog/distributing-javafx-desktop-applications-without-requiring-jvm-using-jlink-and-jpackage