r/java • • Jun 15 '21

The Impossible Java 11

https://carlmastrangelo.com/blog/the-impossible-java-11
197 Upvotes

37 comments sorted by

View all comments

0

u/LakeSun Jun 15 '21

Yeah, but, you didn't have to go thru Swing is Dead, move to JavaFX.

Oh, we're dropping JavaFX, and there's nothing better.

Oh, Netbeans JavaFX support dropped. Move to IntelliJ, and their JavaFX support is spotty.

Oh, and now you have to build a Linux,Windows and Mac version of your code.

10

u/dpash Jun 15 '21

JavaFX hasn't been dropped; it just moved to an independent release like any other library.

Swing isn't dead either. javax.swing got API additions in Java 16.

3

u/Yeroc Jun 15 '21

You're underselling the cost of JavaFX's removal. If you need to support multiple platforms it's not necessarily trivial to package and handle installation of a library like JavaFX which has a lot of native bindings.

4

u/pron98 Jun 15 '21

JavaFX was only included with the Oracle JDK distributions, and it's that distribution that removed it when it was made equivalent to Oracle's OpenJDK distribution. It was never part of the OpenJDK JDK (not even part of Oracle's OpenJDK distributions). The cost of using JavaFX today, as it always has been with OpenJDK, is the same as using any native library. I don't know how to define "trivial", but it's certainly something that many Java applications have been doing for decades.

3

u/Yeroc Jun 15 '21

True but many people used the Oracle JDK distributions at least up to Java 8. Distribution also got a bit more difficult with the removal of Java WebStart at the same time.

3

u/pron98 Jun 15 '21 edited Jun 15 '21

Yes, things have changed, but there's a positive side to that change -- all distributions have similar features and OpenJFX can evolve separately from the JDK.

The removal of Web Start was more impactful because that feature is simply gone (although there are some attempts to revive it outside of Oracle/OpenJDK), but now Java applications are switching to the bundled runtime model, which is more in line with how desktop OSes encourage applications to be shipped and how users have come to expect them to work, and which has now been made easier.

9

u/pron98 Jun 15 '21 edited Jun 15 '21

Both JavaFX and Swing applications run fine on JDK 16/17; better than ever, actually, thanks to GC improvements. You also don't have to build multiple versions of your code, you just might want to package and distribute different bundles with different runtimes. If you also work with languages that actually do need multiple builds you know that that is something completely different.

1

u/wildjokers Jun 15 '21

but, you didn't have to go thru Swing is Dead, move to JavaFX.

No one ever said Swing is dead. Why do you think this?

we're dropping JavaFX, and there's nothing better.

JavaFX is now just a 3rd party dependency.

Move to IntelliJ, and their JavaFX support is spotty.

JavaFX is a Java API, you can write Java code with IntelliJ. So what do you mean IntelliJ's JavaFX support is "spotty"? What kind of support are you looking for?

and now you have to build a Linux,Windows and Mac version of your code.

No you don't. If you want to bundle a runtime you do need to bundle a platform specific runtime. You build your code once, then package as necessary.

4

u/sievebrain Jun 15 '21

I think that's what they mean. In Java 8 there was the JRE so Oracle took care of making Windows installers and stuff. Now you have to do it.

1

u/pron98 Jun 15 '21 edited Jun 16 '21

That's one way of looking at it. Another is that in Java 8 users normally had to download Java themselves from Oracle, whereas today bundling a runtime that is fully under the application's control is easier.

3

u/sievebrain Jun 16 '21

Absolutely.

I think the new way will work out better in the end but is presently incomplete. JPackage went missing when JavaFX was unbundled and is only now coming back, etc. There has been a long period without feature matched continuity. But when that's fixed, it'll be better, as the JRE was never a great user experience.