Running java from browser

Running a Java Program from a Browser without Plugins

Some weeks ago I wrote a little Java program showing a real time plot chart (i.e. records with tracking of current time), with a modest 25 kbps streaming rate, 20fps framing rate, and no relevant user interaction. Thinking on its eventual deployment as a Mobile App, a Web Server chart or simply as a PC as a program, being Java a perfect selection for me. Before starting now the Web version of this program, i started to investigate and according the 2016 Oracle White Paper Migrating from Java Applets to Plugin Free Java Technologies:

The deprecated plugin technology will be completely removed from the Oracle Java Development Kit (JDK) and Java Runtime Environment (JRE) in a future Java release (TBD). Java Web Start applications do not rely on a browser plugin and will not be affected by these changes.

Java Web Start (JWS) was deprecated in Java 9, and starting with Java 11, Oracle removed JWS from their JDK distributions

And then I get lost. Hence, which is the way to go with a Java program like this? Which is the proper sustainable Java way to do this (and not subject to something like what happened to Java Web Start)?. Or should I simply move to another way to do it, now that the program is in its infancy, considering I am not precisely a fan of Phyton, considering PHP is not precisely the way for programming these kind of numerical things, and considering I am not so willing to give Microsoft technologies a chance? It is not a problem for me to adapt and rewrite my current code if necessary, but possibly not doing this every 5 years. Which article would you recommend me to get back to the proper path? Thanks in advance.

Читайте также:  Opc ua javascript client

If you really want to reuse code from your program, information about components and architecture would be helpful for any recommendation.

The usual way to do this is to have a Java-based HTTP service that computes the data and serves them over HTTP, and to have a JavaScript-based chart library consuming and displaying data served by the server. A desktop or mobile application can reuse the same web services, and display the data with a desktop/mobile chart library. «running a Java program from the browser» is basically dead, for years.

@seb.wired I used JChart2D. Not precisely a fan of them, open to replace it in favour or any better real time (10 updates per second) charting solution, but by now it worked.

5 Answers 5

The easiest and highest-performance option is TeaVM, a transpiler that converts Java classes into JavaScript. Your code then runs in the browser natively without any plugin.

Thinking on its eventual deployment as a Mobile App, a Web Server chart or simply as a PC as a program, being Java a perfect selection for me.
(..)
Hence, which is the way to go with a Java program like this? Which is the proper sustainable Java way to do this (and not subject to something like what happened to Java Web Start)?

Two lines of Java

What happened is that our old friend, the Java Standard Edition, split into two lines:

  1. Oracle Java SE («commercial Java»): needs paid license for commercial use for releases since April 16th, 2019
  2. OpenJDK («open source Java»): open source (GPLv2 with linking exception), does not contain Oracle’s Java Web Start implementation

The Oracle Java SE version keeps Java Web Start and Java FX available and supported only for Java SE 8. Newer Java versions, esp. Java SE 11 do not carry these anymore.

It is not a complete client / desktop technology removal, because Oracle, according to the Java Client Roadmap Update 2018, continues to support AWT and Swing for at least 5 more years on both Java SE 8 and Java SE 11.

You can continue deployment via Java Web Start

Open source Java got a decent implementation of Java Web Start, which is free and available for Java SE 8 and newer Java versions like Java SE 11.

This is Karakun’s OpenWebStart based on Red Hat’s IcedTea-Web, now beyond version 1.0, which you already found.

Continued support is not guaranteed but seems likely. So you might continue on this track.

Or you might deploy via an app store

Oracle’s explanation for dropping Java Web Start was, that they want to change the deployment model to applications with bundled runtime:

As client application development continues to shift from the old “plugin” world to modern deployment, the need for a standalone Java Runtime Environment (JRE) that is installed centrally, separately from Java applications has diminished. Using the ‘jlink’ tool introduced with JDK 9 will make it even easier for application developers to package and deploy dedicated runtimes rather than relying on a pre-installed system JRE.

(Source: Faster and Easier Use and Redistribution of Java SE)

Deployment, according to Oracle, would occur via some app store like the iTunes Store:

No doubt this was true, but the OSes have shifted hard and fast away from this model. The «app store» model is now it. macOS has been ratcheting this down hard for several years now. MSFT — even in the enterprise market — has signaled this direction as well. For sure we need to find options to support the legacy, but the future here is limited.

(Source: OpenJDK discussion mailing list)

Note that Java Start Web Start handled the updating of available new versions of applications on the client machines, and so do typical app stores.

Of course you can serve a version of your app with bundled runtime on your web site, but then you usually have to implement some mechanism to handle updates of your application on the machines of your users yourself.

What to choose?

It is true that the separate JRE installation has disadvantages, e.g. I changed my JRE recently and suddenly the IDE for Java did not work anymore. 🙂

Moving deployment from a web site you control to an app store controled by the OS vendor or mighty players like Valve, has its own challenges. E.g. access restrictions, fees, release delays because of the review process, or they might not like your app for some reason and will not publish it.

Then adoption: Personally I have seen private use of app stores mostly on mobile devices and macs, but no use in companies yet. This might be a factor in your decision which road to pursue.

Источник

Running a Java Web Start Application

Note: To run applications deployed with Java Web Start technology, you must have a compatible version of the Java Runtime Environment (JRE) software. The complete Java Java Development Kit (JDK) is not required.

Running a Java Web Start Application From a Browser

You can run a Java Web Start application from a browser by clicking a link to the application’s JNLP file. The following text is an example of a link to a JNLP file.

Java Web Start software loads and runs the application based on instructions in the JNLP file.

Running a Java Web Start Application From the Java Cache Viewer

If you are using at least Java Platform, Standard Edition 6 or later, you can run a Java Web Start application through the Java Cache Viewer.

When Java Web Start software first loads an application, information from the application’s JNLP file is stored in the local Java Cache Viewer. To launch the application again, you do not need to return to the web page where you first launched it; you can launch it from the Java Cache Viewer.

To open the Java Cache Viewer:

  1. Open the Control Panel.
  2. Double click on the Java icon. The Java Control Panel opens.
  3. Select the General tab.
  4. Click View. The Java Cache Viewer opens.

The application is listed on the Java Cache Viewer screen.

A screen shot of the Java Cache Viewer application

Java Cache Viewer application

To run the application, select it and click the Run button, , or double click the application. The application starts just as it did from the web page.

Running a Java Web Start Application From the Desktop

You can add a desktop shortcut to a Java Web Start application. Select the application in the Java Cache Viewer. Right-click and select Install Shortcuts or click the Install button, .

A shortcut is added to the desktop.

You can then launch the Java Web Start application just as you would launch any native application.

Источник

Running java from browser

  • The basics of TOGAF certification and some ways to prepare TOGAF offers architects a chance to learn the principles behind implementing an enterprise-grade software architecture, including.
  • Haskell vs. PureScript: The difference is complexity Haskell and PureScript each provide their own unique development advantages, so how should developers choose between these two .
  • A quick intro to the MACH architecture strategy While not particularly prescriptive, alignment with a MACH architecture strategy can help software teams ensure application .
  • Postman API platform will use Akita to tame rogue endpoints Akita’s discovery and observability will feed undocumented APIs into Postman’s design and testing framework to bring them into .
  • How to make use of specification-based test techniques Specification-based techniques can play a role in efficient test coverage. Choosing the right techniques can ensure thorough .
  • GitHub Copilot Chat aims to replace Googling for devs GitHub’s public beta of Copilot Chat rolls out GPT-4 integration that embeds a chat assistant into Visual Studio, but concerns .
  • Navigate multi-cloud billing challenges Keeping track of cloud bills from multiple clouds or accounts can be complex. Learn how to identify multi-cloud billing .
  • 5 Google Cloud cost optimization best practices Cost is always a top priority for enterprises. For those considering Google Cloud, or current users, discover these optimization .
  • How to create and manage Amazon EBS snapshots via AWS CLI EBS snapshots are an essential part of any data backup and recovery strategy in EC2-based deployments. Become familiar with how .
  • BrightTALK @ Black Hat USA 2022 BrightTALK’s virtual experience at Black Hat 2022 included live-streamed conversations with experts and researchers about the .
  • The latest from Black Hat USA 2023 Use this guide to Black Hat USA 2023 to keep up on breaking news and trending topics and to read expert insights on one of the .
  • API keys: Weaknesses and security best practices API keys are not a replacement for API security. They only offer a first step in authentication — and they require additional .
  • AWS Control Tower aims to simplify multi-account management Many organizations struggle to manage their vast collection of AWS accounts, but Control Tower can help. The service automates .
  • Break down the Amazon EKS pricing model There are several important variables within the Amazon EKS pricing model. Dig into the numbers to ensure you deploy the service .
  • Compare EKS vs. self-managed Kubernetes on AWS AWS users face a choice when deploying Kubernetes: run it themselves on EC2 or let Amazon do the heavy lifting with EKS. See .

Источник

Оцените статью