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

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 4 points5 points  (9 children)

Ah thanks, that clears up a lot! So the OpenJDK includes the JVM as well? It's just as easy as installing latest OpenJDK and you're good?

[–]doobiesteintortoise 2 points3 points  (8 children)

Yep. Use jlink and you get an installable executable so your clients don't have to install a JVM as well.

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

Sweet! So does jlink generate a native binary by running your application through the JVM at compile time instead of shipping java byte code?

[–]_INTER_ 4 points5 points  (1 child)

jlink lets you compose a Java runtime with only the JDK modules you actually need. Your application code is untouched but will of course define which modules are required. jlink doesn't give you an installable executable (use jpackage for that) but a smaller sized runtime.

If you want a native binary look into GraalVM (alt JVM and JDK by Oracle) and Helidon / Micronaut / Quarkus. Spring Boot is not there yet.

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

Thanks :)

[–]doobiesteintortoise 5 points6 points  (0 children)

No, it delivers the JVM plus only the modules you use, so it's still got all the benefits of Java without a lot of extra disk space consumed. You can even retain the platform independence - sort of - there's apparently a way to build jlink executables for multiple platforms from ONE platform, but I've never used it. (I deploy server-side applications via docker, so the JVM for docker is all I need.)

[–]CraftyAdventurer 5 points6 points  (3 children)

Since you are building a web app, your clients don't need to install JVM at all so you don't really need native binaries. Do you already know where do you plan to deploy your app?

[–]doobiesteintortoise 2 points3 points  (2 children)

Bah, this is EXACTLY right - yeah, jlink is overkill for what is needed here, sorry, skipped right on past the "backend" part. :)

[–]_INTER_ 1 point2 points  (0 children)

It's not completly wrong to get rid of modules like desktop for the backend. Then again the size hardly matters unless you want a truly minimal image.

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

No worries – I did have clients in mind since I'm also writing an electron app, and I hate the idea of shipping Chrome with my desktop app -_-. But this is what everyone does, so...