Previously, this is how we deploy legacy desktop application (https://jstock.org, written in Swing and JavaFX) to clients.
Developed in Swing and JavaFX
Use NetBeans as IDE
Use Java 8
Use Oracle JDK
Use Launch4J to create EXE
Use NSIS to create installer, will help user automatically download JRE from http://javadl.oracle.com/webapps/download/AutoDL?BundleId=216434
Due to the complex licensing requirement introduced by Oracle, we want to move away from Oracle, and go for Amazon Corretto or AdoptOpenJDK or Azul or whatever is free.
We want to take this opportunity to migrate to Java 11. But, we notice that there are no JRE for Java 11.
After some research, we though we might need "Self-Contained Application Packaging" technology, to deploy our Desktop app solution to clients, if we were to use
Developed in Swing and JavaFX
Use NetBeans as IDE
Use Java 11
Use Amazon Corretto or AdoptOpenJDK or whatever is free
The information we came across is https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html#A1307236 . But, it is pretty brief, and we still don't know how we can apply "Self-Contained Application Packaging" for our case?
Do you come across any good tutorial resource, to deploy Java 11 desktop app?
Related
I read here that it's possible to deploy a JavaFX application into a Web Browser:
embed-a-javafx-application-in-a-html-webpage
Now I got stuck at the beginning when he talks about using the java packager to create an executable .jar file. I'm using Maven which uses JavaFX 18, so I followed this tutorial on how to package a java project
java-packager-with-jdk11
Here I got confused with the tools he uses. I downloaded the listed tools and moved the jpackager files into the according directories. Still in cmd it gives me an "Error during initialization of boot layer": jdk.packager not found.
It's pretty worth it knowing how to create a Package from a Java Project, but is this the proper way?
tl;dr
No, not realistic.
You have a choice of alternatives.
Legacy technologies
That page uses legacy technologies, Java Web Start and Java applets.
Java applets have been phased out by all web browser makers, so Oracle consequently decided to phase out the technology. Java applets were first deprecated in Java 9, and later deprecated for removal in Java 17.
Oracle no longer expects end-users to have a standalone JRE or JDK installed on their computer. So Java Web Start is no longer available by default for the consumer market. Java Web Start is no longer included in Java 11+.
However, an open-source implementation continues in the OpenWebStart project. For some environments, such as corporations or schools where the installed base of computers is centrally managed, OpenWebStart may be a useful way to distribute apps.
Ship your app with JVM bundled
Oracle now expects desktop apps and mobile apps to bundle a JVM within their product. This does mean the app must be built in editions, one edition for each supported chip architecture and OS, but also allows the app to be tested with the same JVM that will eventually run the app.
For more info, see the Oracle white paper (PDF format), Java Client Roadmap Update of 2020-05.
New tooling is available to support this JVM-within-app packaging:
Java Platform Module System (JPMS) in Java 9+.
jlink in Java 9+.
jpackage in Java 16+.
Search Stack Overflow to learn more about packaging JavaFX/OpenJFX apps for distribution. Many Questions and Answers have already been posted on the topic. The topic is rapidly evolving, including cutting-edge approaches such as using GraalVM for ahead-of-time compilation to run native.
Vaadin Flow
If you want to build a single-page web app written in pure Java without you needing to learn HTTP, HTML, CSS, JavaScript, WebSockets, Push, etc., consider using Vaadin Flow. This open-source framework is based on venerable Jakarta Servlet technology.
You write Java code similar to that in JavaFX, defining forms by specifying widgets arranged with layout managers. Vaadin Flow then auto-generates the needed HTML+CSS+JavaScript to render the user interface remotely in the web browser while maintaining the state of your app on the server. Pure Java on server, no Java on client.
I've found exactly the same question I just made but it is 7 years old; so I'd like to have an "updated" answer if it is possible. Thanks.
Old days
As commented by TrogDor, there were previously two ways to deploy a Swing app through the web:
Java Applet technologyYour app would appear within a rectangle on the web page, within the browser.
Java Web Start technologyClicking a link on a web page would download a copy of your Swing app to the user’s local machine, where your app would then be launched locally using a locally-installed JVM. So your app runs separate from the web browser. This click-to-download-and-run process is defined by Java Network Launching Protocol (JNLP).
Both of these are being phased out.
➥ For details, see the white paper Java Client Roadmap Update published by Oracle, updated 2020-05-11.
Nowadays
The modern approach is to build a Swing and/or JavaFX app, then deploy by using a packaging tool to include a JVM. You end up with a complete self-contained self-launchable application.
This means you need multiple builds, one app for each platform your users may deploy on (macOS, Linux, BSD, Windows, and so on). While that is an additional burden to you, the flip-side is that you control exactly what version of Java is being used to run your app.
Because of the Java Platform Module System (JSR 376) in Java 9 and later, you can now strip down the bundled JVM and libraries to include only the parts actually used by your particular app.
The build tools for packaging your app have been rapidly evolving in recent years. So be sure to do your research to find the most robust and modern tooling.
Alternatives
You might consider any of these alternatives:
Remote execution
OpenWebStart A re-implementation of Java Web Start
GraalVM Ahead-of-time native-code compilation of your Java app
Vaadin Flow Using Java to build desktop-style apps delivered as web apps
Remote executions
Some vendors may offer a product or service to execute your Swing app remotely while displaying the user-interface within a web browser.
One such company is WEBSWING Ltd. with their Webswing product.
OpenWebStart
You might be interested in a separate implementation of Java Web Start technology.
While Oracle is phasing out Java Web Start, there is an open-source implementation of JSR 56: Java Network Launching Protocol and API called OpenWebStart. See GitHub. This project is currently maintained by the company Karakun, based on the IcedTea-Web core functionality developed at Adoptium (née AdoptOpenJDK).
GraalVM
A cutting-edge alternative is to build an entirely native-code ahead-of-time compiled version of your app using GraalVM.
Vaadin Flow
An entirely different way to build a web app by using Java is the Vaadin Flow framework.
You specify your user-interface layouts with widgets in a manner quite similar to Swing, specifying an arrangement of widgets (buttons, fields, labels, etc.). You can do so using your choice of straight Java code, an XML-based description language, or a visual design tool.
At run-time, Vaadin automatically automatically generates the HTML, CSS, and JavaScript necessary to render your app remotely on the client user’s machine within a web browser. So, you have pure Java on the server-side, and no Java on the client-side, just Web standards technologies built into all modern browsers.
More info
All of this has been covered many times already on Stack Overflow. So search to learn more.
For tips on obtaining a JVM to bundle with your app, see How to get java 11 run-time environment working since there is no more jre 11 for download?.
Nowadays you can run Swing app on server with UI in the browser. You can find example here: https://github.com/JetBrains/projector-demo.
Update: JetBrains ceased development of Projector as a separate product. See their notice. They have incorporated the technology for their own use in their Gateway product for remote execution of their IDE products.
The Java Preferences application on my OS X Lion workstation indicates that I have Java SE 6 v1.6.0_29-b11-402 installed (both 32- and 64-bit versions). Unfortunately, I need additional features at are only available in the Enterprise Edition.
A comment by 'Jesper' in 'How install a specific jdk on Mac OS X?' suggests that I need to use the Java supplied by Apple, rather than the one from Oracle/Sun. Unfortunately, it doesn't seem that Apple offers an Enterprise Edition of Java 6.
This leads me to ask a number of questions:
Did I miss something? Does Apple offer an EE of Java 6?
If 1 is true, how do I get it? Can it be installed 'side by side' with the Java SE 6?
If 1 is false, can a Oracle/Sun version be used? Is there a recommended installation location? I'm guess that the /System/Library/Frameworks/JavaVM.framework/Versions/ folder is not recommended.
The Oracle/Sun version seems to include a lot of extras (e.g. Glassfish) that I would prefer not to install. Can I install the core SDK w/o the extras? Will Tomcat 7 work as an alternative to Glassfish?
** edit **
This question is a result of another question that I posted: RESTful web service: java.lang.NullPointerException service.AbstractFacade.findAll. It seems that this particular error is a result of a missing annotation (#Stateless). This annotation is 'contained' in the javax.ejb.* namespace, which is contained in a .JAR file that is not on my workstation.
This led me to conclude that I needed the 'Enterprise Edition' of Java 6 (which would have the missing .JAR file and other dependent files). I suppose if there was a way to determine which .JAR file is missing (Netbeans 7 doesn't seem to help with this) I probably could just add it to the project and skip the EE hassles.
There is no such thing as a special runtime called Enterprise Edition of Java for any platform.
There is Java SE and there are simply some interfaces that an Enterprise Edition container implements.
Sun confused the market with the naming convention years ago when they came up with J2EE. It never was a separate version of Java, just some tacked on APIs that if a server implemented them and passed some certification, could call themselves a J2EE container.
They further confused the market when they started calling it Java EE 6.
If you are developing against these APIs all you need is the .jar files that contain these interface declarations. You can download these API .jar files which used to be called J2EE. But they are pretty useless by themselves.
But I doubt that you are wanting to write a Java EE server, you want to use one. If you want to use a server then you need to download a Java EE compliant server and use the .jar files it provides.
Every IDE worth using includes these in some form, usually by defining a Server that you will be deploying against. Tomcat isn't a fully EE container. It is a Servlet container, which is a subset of the full EE specifications.
As of OSX Lion, Apple doesn't supply a JDK anymore, it is only the Oracle one, which you apparently already successfully acquired.
Java EE 6 is a spec, with some accompany API represented as interfaces. Java EE 6 in and of itself is not an implementation of those APIs. If you wish to use the Java EE 6 APIs you will need to avail your self of a compatible Java EE Application Server. Glassfish is the reference implementation of Java EE 6, however there are other servers as well that are compliant. JBoss is another popular option.
These install easily on Mac OS X.
There is a Java EE download. http://www.oracle.com/technetwork/java/javaee/downloads/index.html On its own though, its not particularly useful unless you're trying to develop an application that is intended to run in multiple containers.
What you will typically want to do is to download a container and develop with that. e.g. Glassfish (available at same link above). This task can be made easier with support from an IDE such as Netbeans. You can download a version of Netbeans that already includes Glassfish and the Java EE APIs and just start working. Other IDE/container combinations are possible, usually there is some sort of plugin available.
The Java 6 JDK/JRE for OSX is still from Apple. They transitioned most of the code to Oracle however, and the OSX version of JDK 7 is close to release status, and it may be mature enough for your purposes. My best guess is that it is.
I am new to JavaFx technology, I would like to know whether I can have JavaFx on a Linux kernel 2.4.26 (no other commercial distribution), it is a touch screen based navigation system runs on a ARM9 processor (200MHz, 32MB RAM).
While searching, I found that JavaFx is supported on Linux platforms, but I couldn't find any reference to my particular version of Linux (Linux kernel 2.4.26). Is it possible to install and run JavaFx on this machine? Also please tell me whether standard JavaFx or JavaFx mobile is more suitable for this system.
regards
Jamsheer
JavaFX is not supported on ARM at this time.
I know almost nothing about JavaFx, but to run JavaFx, you need to install Java SE first, isn't it?
This embedded java SE download page has ARM Linux Early Access binaries
http://java.sun.com/javase/downloads/embedded.jsp
and this release notes says, its still underdevelopment and but its said you still can run simple applications with some limitations.
From:
http://java.sun.com/javase/embedded/reference/release6/EmbeddedReleaseNotes_6.html#javafx
How to Run JavaFX Applications
JavaFX™ support in Java SE for Embedded (headful version) on Linux ARM is still under development at the time of this writing.
However, you can run simple JavaFX applications on Java SE for Embedded 6 Update 10 on Linux ARM v6, although with some limitations. JavaFX applications cannot be run from a web browser on the Linux ARM platform. You must manually download the JavaFX 1.2 Software Development Kit (SDK), compile the sample applications included, and run the applications from a shell. These steps are explained in detail below.
Do the clients need something else than a proper jdk and javafx compliant browser to visit javafx applets?
JavaFX is based on download able JARs. I think there are multiple runtimes, but all of them Require JRE 1.6. The JavaFX classes will be loaded by the WebStart or Applet Classloader, so the JRE does not need to provide this extension.
However as there are some new Features of Java 6 Update 10 specifically targeted for rolling out JavaFX applets, it is most likely that this is the best choice. Update 10 has a new Java Plugin with improvements in speed, installation and stability, and it allows quicker initial installation.
The following JNLP Samples with fine with the released Java 6u10:
http://javafx.com/htdocs/samples.html
http://a.stritzinger.googlepages.com/jfxrace
Ok, thanks for this information. All the samples were "standalone" applications that run "outside" the web browser (a new program was launched, you had to download it and accept some signatures/certs). Is it possible to run the applets inside a browser? (more transparency for my client)
JavFX can be run as an applet and the Java plug-in for running applets was rewritten for Java 6ul10 to provide a better experience for everyone for the JavaFX release.
You can see plenty of applet examples at JavaFX.com as well as the samples in the Netbeans 6.5 JavaFX plugin.