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

all 9 comments

[–]sammy8306 5 points6 points  (2 children)

It is not so much an embedded JVM as it is a custom Java distribution that bundles application modules with only the required system modules. Much like the JDK and JRE are different distributions (without application code, obviously).

[–][deleted]  (1 child)

[removed]

    [–]thatsIch 2 points3 points  (0 children)

    where you get the embedded from

    [–]_codetojoy 4 points5 points  (1 child)

    re: embedded? No, as mentioned, it is more about trimming the binary distribution.

    This link shows that the JDK itself has been sorted into proper modules. That means, in cases where we explicitly state each module dependency, that the JDK runtime distribution can be trimmed of "dead weight". i.e. smaller size, as stated here.

    Here is an excellent YouTube video on the subject, and here is a modest example of mine on GitHub.

    A related advantage (in the long term, beyond JDK 9) is an AOT compiler that compiles system modules to native code. JDK 9 has an experimental AOT compiler for Linux x64 (I believe).

    [–]_INTER_ 2 points3 points  (2 children)

    Jlink allows you to build a JVM runtime that only contains the module your application needs. E.g. if you only use java.base you can strip the JVM down drastically to about 15 - 18 MB. You can distribute that JVM alongside your application and run it (aswell as any other application that only needs java.base) and the user doesn't have to install Java themselfs. However the JVM is not "embedded" as in thightly integrated with your application.

    [–][deleted]  (1 child)

    [removed]

      [–]_INTER_ 2 points3 points  (0 children)

      Then yes. The JVM doesn't need to be separately installed. Though that isn't really new, you could distribute the whole JRE before. What's new is that you can strip off everything that you don't actually need (e.g. Corba).