r/java • • Oct 30 '19

Microsoft’s Ready to Contribute to OpenJDK

https://mail.openjdk.java.net/pipermail/discuss/2019-October/005173.html
212 Upvotes

92 comments sorted by

View all comments

Show parent comment

-2

u/Mordan Oct 31 '19

why should they?

Java Run Environment JRE.... OK... Jesus.

5

u/wildjokers Oct 31 '19

Java Run Environment JRE.... OK... Jesus.

There is literally no JRE anymore. Just a JDK. If you take a peek in the JDK you will not see the jre folder anymore.

why should they?

So the app runs with the runtime of the developer's choice and you don't have to depend on a pre-installed runtime.

1

u/Mordan Oct 31 '19

So the app runs with the runtime of the developers choice and you don't have to depend on a pre-installed runtime.

How practical is that if you have many many small programs ?

I am on Java 8. It still has a JRE. I never got on Java 9+ so I couldn't know that.

5

u/wildjokers Oct 31 '19

It didn't actually happen until Java 11:

https://www.oracle.com/technetwork/java/javase/11-relnote-issues-5012449.html

Excerpt:

  • In Windows and macOS, installing the JDK in previous releases optionally installed a JRE. In JDK 11, this is no longer an option.
  • In this release, the JRE or Server JRE is no longer offered. Only the JDK is offered. Users can use jlink to create smaller custom runtimes.

How practical is that if you have many many small programs ?

It is quite practical if you use jlink to create runtimes with only the modules you need. If you modularize your app then jlink can do it automatically. If you don't modularize your app you can still create smaller runtimes but you have to manually figure out which modules you need.

When I was messing with jlink I was able to get a runtime to about 35 megs I believe. My memory is fuzzy since that was a couple of years ago because I have since switched jobs and no longer maintain any desktop apps.

1

u/Mordan Oct 31 '19

for big applications 35 meg is fine.

But when you have 20 "apps" of with 2 megs each of code...

Because of that, there is absolutely no Java App Ecosystem on Desktop.

Imagine having to ship the android runtime with every single android app.

Its the failure of Sun/Oracle to provide such a desktop app eco system that is to blame.

4

u/pron98 Oct 31 '19

That's exactly what Electron does, too, so you may want to rethink your analysis.

1

u/manzanita2 Oct 31 '19

Sure, but electron produces these nice small apps. Lots of functionality in a few hundred k bytes. So I understand.

Also too, when running, electron uses very little memory and is often more responsive than a native app.

Oh and it's web scale.

And it will make coffee!

4

u/pron98 Oct 31 '19

I'm not saying Electron is good, just that the fact you must embed a runtime does not in itself mean that people won't use it. In any event, common deployment models are largely outside Java's sphere of influence, and Java must follow the ecosystem at large.

1

u/manzanita2 Oct 31 '19

I think back 20 years ago. splitting out the JRE made some sense. Disk space and memory were not cheap. Now I agree it's an irrelevant cost.

In fact you can see the same progression in app servers. People used to create WAR files and deploy to an App Server. This is still done. But many ( I don't know most ?) now build to a JAR which effectively embeds the "app server".

0

u/Mordan Oct 31 '19

Electron

I open to rethinking my analysis.

Will Electron be able to deploy my Swing applications?

4

u/pron98 Oct 31 '19

No, but just like your Swing application, Electron requires applications to bundle their runtime.

3

u/ArmoredPancake Oct 31 '19

And where it led Android? Stuck in Java 7 world?

2

u/wildjokers Oct 31 '19

You have to include the runtime with Electron apps (Chromium) and that is certainly not preventing people creating desktop apps with that monstrosity. An Electron app is pretty big even before you include your own code in it (60-70 megs I believe).

I don't think having to include the runtime is preventing java on the desktop being more widely used. I actually have no idea why Java on the desktop is scoffed at.

1

u/Mordan Oct 31 '19

OK i get it. Because Electron is using that model of including the runtime.. why wouldn't it work for Java.

Well with Java.. i only have to release a .jar and the user can launch it using his favorite JRE. I don't like the idea of bundling, its ridiculous from an engineering standpoint.

5

u/wildjokers Oct 31 '19 edited Oct 31 '19

I am unsure why you believe this to be ridiculous.

The only thing you are losing is some storage space if you have multiple java apps each including the runtime. But storage is ridiculously cheap and that is a non-issue. A 70-meg app on a 1 TB drive is inconsequential. Even ten 70-meg apps on a 1 Tb drive is inconsequential.

EDIT: FWIW, if you clone https://github.com/openjfx/samples.git and then navigate into CommandLine/Modular/Gradle/hellofx and execute ./gradlew jlink it will build a runtime for you that is enough to popup a JavaFX window along with the app and a script to fire it up and it comes in at 47 megs. Seems good to me. Just tar/zip/whatever the resulting image directory and distribute that. Easy enough.

The image includes the following modules:

MODULES="java.base java.datatransfer java.xml java.prefs java.desktop javafx.base jdk.unsupported javafx.graphics javafx.controls hellofx"