2

Scenario:

My company is maintaining an applet that is used by many machines through Java Web Start.
Java Web Start is triggered by an JNLP file that contains all the informations and parameters to start the applet.
The only thing I have access to is the JNLP file to start the applet. The applet itself and all the JARs it uses are on a remote server.

Edit: I don't have access to the applet source code or JAR file. That means I can't modify it in any way and, also, I can't execute the JAR through third party software. I only have a functioning JNLP file.

Question:

The company asked me to develope a launcher to execute this applet without using Java Web Start or any kind of browser.
Since I only have the JNLP file available, is it possible to build such a launcher? And if it is possible, does someone know what should I do? I have been searching everywhere far a solutions but I couldn't find one.

7
  • If the concern is about Oracle phasing out Java Web Start, consider the open-source alternative implementation, OpenWebStart. I don’t know if it supports applets or not. Commented Jun 19, 2024 at 14:55
  • @BasilBourque Due to some incompatibility with how OpenWebStart names some classes and the applet, it has been decided to keep OpenWebStart as a last option. Commented Jun 19, 2024 at 15:01
  • The company asked me to develope a launcher to execute this applet without using Java Web Start or any kind of browser Applets are launched on the client machine. Older JDKs had appletviewer. That should do it Commented Jun 19, 2024 at 15:57
  • You can easily rewrite an applet to be a standalone Swing app. Then you can bundle a JVM, and distribute as a double-clickable app. Commented Jun 19, 2024 at 17:31
  • Or, with more work, you can rewrite the user-interface to be a web app by way of the Vaadin Flow framework. That framework works similarly to Swing, event-driven widgets arranged in layout managers, written in pure Java. Commented Jun 19, 2024 at 17:31

2 Answers 2

2

After deprecation in Java 9, Java applets have been phased out by Oracle and by all the web browser makers. Also, Java Web Start was deprecated in Java 9, then phased out in Java 11.

I see a few options for your migration.

Older JDK with AppletViewer

You could stick with Java 8. It comes bundled with the appletviewer tool to run applets without any web browser.

Be sure to read the licensing terms of the particular JDK product regarding fees and regarding your right to distribute across users. You have a variety of JDK vendors to choose from including Azul Systems, BellSoft, SAP, Adoptium of Eclipse Foundation, Microsoft, Amazon, Oracle, IBM, Red Hat, and more.

Java 8 may be reaching end-of-life. But as the first long-term support (LTS) version of Java, you may be able to purchase support from some of the vendors listed above.

OpenWebStart

Oracle has phased out Java Web Start. See the 2020-05 white paper, Java Client Roadmap Update.

However, the technology lives on. An alternative open-source implementation is ongoing: OpenWebStart.

See Migrating Java Applets to Java Web Start and JNLP by Oracle.

Swing

Your applet was likely written using the Swing GUI framework. If so, it is trivially simple work to make that applet into a standalone Swing app.

For couple examples, see this and this.

Once you have it working as a Swing app, you can then bundle a JVM using jlink tooling. And then package as a double-clickable app using jpackage tooling.

If you want to go even further, you could step out to the bleeding edge of technology: Use GraalVM technology to build a native app.

Vaadin Flow

Yet another approach is to rewrite your applet as a web app. You would keep your business logic code intact, but replace the user-interface code.

By way of the Vaadin Flow framework, you can rebuild each screen’s Swing layout manager containing event-driven widgets into a Vaadin Flow screen using similar layout managers and similar event-driven widgets. Though not a one-to-one replacement, the basic concepts are similar between Swing and Vaadin Flow. So a rewrite is not as daunting as you might think.

You write a Vaadin Flow app using pure Java, and perhaps a sprinkling of CSS for optional styling. You then deploy to a Jakarta Servlet container where the app is served out to web browsers. The user-interface in the browser is automagically generated using only standard Web technologies (HTML, CSS, JavaScript, Web Push, etc.) — no Java on the client-side.

With Vaadin Flow, you can leverage all your Java knowledge while having to learn little to nothing about the Web technologies.

Sign up to request clarification or add additional context in comments.

4 Comments

To complement Basil's answer, on how simple it could be to rewrite the applet into a standalone Swing app, I have done this before on this answer, it could help you get started hopefully
Except OpenWebStart, all the your solutions require access to applet project, right? I, sadly, don't have that. The project is old and went through many companies. Right now, I only have a working JNLP with Java Web Start and that's it.
Also, I see that Appletviewer is intended to be used as a development-only solution. But i need to launch this applet on machines customer side.
@Soku: More hybrid applet/application examples may be found here.
2

CheerpJ

CheerpJ is a WebAssembly-based Java Virtual Machine (JVM) for the modern web browser. This means a Java applet can be executed from the browser with no Java installations on the user machine.

In my situation, CheerpJ was the only viable solution. Our specific use case aligned perfectly with its capabilities, so my company and I chose to use this technology to deploy our applet in modern browsers. All other options have failed. If you don't have access to the project source-code, this is the only way to go.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.