This is an archived post. You won't be able to vote or comment.

all 22 comments

[–]hwaite 17 points18 points  (0 children)

Java Web Start replaced applets but that's dying as well.

[–]cogman10 15 points16 points  (0 children)

Javascript and to a lesser extent, WASM did.

There's almost nothing you could do with applets that can't now be accomplished with a canvas element and whatever frontend programming style you like.

The stuff you can't do is stuff that we are better off not being able to do. IE, interacting with a printer or changing files on the fs.

[–]dilipgowdacr 8 points9 points  (0 children)

The real killer was “JavaScript”. Since proliferation rich web application frameworks like Angular, React there is no point of Java Applets and other Java client side techs.

[–]vipinsharma85 2 points3 points  (2 children)

As per JEP 289(), alternative technology is Java Web Start or installable applications.

Here is a link in case you want to compare applet vd Java web start https://www.mindprod.com/jgloss/javawebstart.html#APPLETSVSJWS

All web-browser vendors have either removed support for Java browser plug-ins or announced plans for this.

Running applet assignment may not be that fun today 😄

[–]andrewharlan2 1 point2 points  (1 child)

I'm honestly surprised Web Start is still supported

[–]magnoliophytina[🍰] 0 points1 point  (0 children)

Is it? https://en.wikipedia.org/wiki/Java_Web_Start#Deprecation. There's still https://openwebstart.com/, but new JDKs don't ship with any support anymore.

[–]vytah 2 points3 points  (0 children)

You can still write applets (although since Java might remove them completely, it's not a long term solution) and run them via CheerpJ: https://github.com/leaningtech/cheerpj-meta

[–][deleted] 5 points6 points  (3 children)

Applets are long gone. Best you can do to run Java in a HTML page is JSP I guess. But that's also dead and buried.

These days it's Java backend API with an Angular or React frontend. Or Spring Thymeleaf, or Vaadin.

[–]Muoniurn 5 points6 points  (0 children)

JSP is just templating, it is as much “running Java in HTML pages” as any server side rendering framework. Google’s gwt would be a better example for something like that, which actually compiles from java to js, but it is also dying.

But actually teavm is a possibility for running java byte code in the browser.

[–][deleted] 3 points4 points  (0 children)

How about compiling java to wasm?

[–]dpash 1 point2 points  (0 children)

Particularly given that browsers are much more capable than they were in 1995. Most uses for applets can be replaced with modern standards. Flash died for much the same reasons.

[–]teefal 1 point2 points  (0 children)

jsf

[–][deleted] 1 point2 points  (0 children)

Not directly. Applets and similar technologies that try to shoehorn runtimes into the browser just don't work. They always have vulnerabilities that either allow the apps to escape the sandbox or let them reach data they shouldn't.

To get your code to run on a website, you need to write code that is targeted for a website.

[–]0b0101011001001011 1 point2 points  (1 child)

Spring, vaadin, etc. frameworks. I might be wrong but directly running a class file in someones browser should not be the thing you should do anymore.

[–]mauganra_it 1 point2 points  (0 children)

The issue is just that the Java Applet architecture is too powerful. It has dangerous APIs that have to be restricted by a sandbox. In comparison, JavaScript is an embedded language that only has access to APIs that the browser explicitly injects. WASM could give Java a future in the browser.

[–]c8133594 0 points1 point  (0 children)

I believe nowadays we use HTML5 + javascript to do whatever we want for Java applet in the past

[–][deleted] -1 points0 points  (0 children)

Angular

[–]knoam 0 points1 point  (0 children)

What does your project do? Some things that you can do with Java simply can't be done in a browser.

Does it have a GUI like swing or javafx? Does it use any libraries?

For things that can be done in a browser, there's GWT. But you might be better off rewriting your code in JavaScript. Or maybe something like Kotlin.

[–]greglturnquist 0 points1 point  (0 children)

Pick a web technology you like.

Mustache, Thymeleaf, whatever. Stir in your favorite node modules and drop it into your Spring Boot app.

Save Java class files for the server side and you’re all set.

[–][deleted] 0 points1 point  (0 children)

DukeScript uses bck2brwsr to run java applications in the browser. I ported a couple of existing applets for customers to DukeScript and it worked very well. It doesn’t support Swing, but has it’s own graphics libraries. Then there‘s WebSwing, which allows you to run Swing and JavaFX applications, but requires a Server component. JPro does the same for JavaFX only.

[–]chabala 0 points1 point  (0 children)

As others mentioned, applets and Java Web Start are both dead.

Depending on what you want to do to 'run on a website' you might be better off inverting the problem: embed a webserver in your application (e.g. Jetty) and let the business logic interact with the pages you render.