Announcing GraalVM 19.3 with JDK 11 Support

Oleg Šelajev
Nov 20 · 4 min read

Today it is our great pleasure to announce the release of GraalVM 19.3 which includes the much anticipated support for JDK 11 along with a number of other exciting improvements. Before digging into the details, we would first like to thank the community for the excellent collaboration from reporting feedback to contributing code with pull requests. Working together we can continue to make GraalVM awesome!

GraalVM 19.3 is the first of the planned longer-term support (LTS) releases built from the main line of the project. It will continue to receive stability, security, and select performance fixes until the next LTS release is available. We believe this strategy will provide a good level of stability for developers who work with GraalVM.

In this post we will focus on the new JDK 11 support so please check out the release notes for details on improvements to tooling and to support for Python, Ruby, JavaScript, R and LLVM.

JDK 11

Like previous releases, GraalVM 19.3 continues to support JDK8 based build. So if you are happy on JDK 8 you can still use it with GraalVM 19.3. But if you have been waiting for JDK 11 support then you’re in luck! New in the 19.3 release is support for JDK 11 with GraalVM Enterprise Edition based on Oracle Java 11.0.5 and GraalVM Community Edition based on OpenJDK 11.0.5. You can download both from the GraalVM website.

Since JDK 11 based GraalVM builds are compatible with Java 11 you can use it to run Java or other JVM language applications requiring Java 11. This means you can benefit from all the improvements which went into OpenJDK from 8 to 11 while still using the GraalVM compiler as the top tier optimizing JIT compiler on the JVM.

For example, you can now write a class like the following:

public class HelloWorld {
public static void main(String[] args) {
var name = args.length > 0 ? args[0] : "world";
System.out.println("Hello " + name + "!");
}
}

Note that the var keyword not available in Java 8, you can now run it with $GRAALVM_HOME/bin/java HelloWorld.java.

$GRAALVM_HOME/bin/java HelloWorld.java "GraalVM 19.3"
Hello GraalVM 19.3!

There are at least two major performance related changes to be aware of when migrating from Java 8 to 11 including compact strings and the use of G1 garbage collection by default. G1GC is a concurrent garbage collector which aims to have smaller stop-the-world pauses. It works in parallel with your application which can potentially influence the overall throughput of your code. So be mindful of this change if you’re migrating from JDK 8 based GraalVM builds to JDK 11 based ones.

Another large change between 8 and 11 which Graal 19.3 supports is the inclusion of the Java Platform Module System (JPMS). GraalVM uses module encapsulation to isolate the code of the GraalVM compiler and the Truffle API from application code and can, of course, run your modularized apps.

From the distribution point of view, JDK 11 based GraalVM 19.3 does not include a JRE (just like OpenJDK JDK 11), so the languages are installed right into the GraalVM home directory:

Difference in the location of the languages in JDK 8 and JDK 11 based GraalVM 19.3
Difference in the location of the languages in JDK 8 and JDK 11 based GraalVM 19.3
Difference in the location of the languages in JDK 8 and JDK 11 based GraalVM 19.3

GraalVM Native Image in 19.3

GraalVM Native Image functionality now also supports Java 11 code as an early adopter technology feature. Currently the native
image builder (`$GRAALVM_HOME/bin/native-image`) does not support the Java Platform Module System (JPMS) and has no module introspection at image run time.

To test it you can try building a native image of the same hello world example above:

❯ javac HelloWorld.java
❯ native-image HelloWorld
...
❯ time ./helloworld "GraalVM 19.3 native images"
Hello GraalVM 19.3 native images!
./helloworld "GraalVM 19.3 native images" 0.00s user 0.00s system 49% cpu 0.012 total

As you can see that the startup time of the GraalVM native image based on Java 11 code is still milliseconds.

In GraalVM 19.3 Native Image switched to statically linking the JDK’s native code instead of manually provided substitutions for that native code. This change is a major factor in enabling JDK 11 based GraalVM distributions on Windows. It also has no impact on startup time or memory footprint of native images and eliminates the need for shipping JDK libraries such as libsunec.so along with native images that use Java crypto services. All in all, it makes maintenance of the GraalVM Native Image technology easier and simplifies upgrading GraalVM to support newer Java versions.

Maven Updates

Another very important change in 19.3 is the difference in the Maven coordinates for the GraalVM Native Image related jars. The group id for the artifacts is changed from com.oracle.substratevm to org.graalvm.nativeimage. For example if you’d like to use the Maven plugin for native images, your pom.xml should have the following entry:

<plugin>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>native-image-maven-plugin</artifactId>
<version>19.3.0</version>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>

Conclusion

GraalVM 19.3 is a very significant release with a number of new features and improvements which were generating lots interest on social media and in the GitHub issues comments. In this release there are Java 11 based builds, ARM64 builds, upgrade of Node.js support to the 12.x LTS branch, new tooling that enables greater visibility into your application behavior and many other changes you can learn more about in the release notes.

Please download GraalVM 19.3, try it, test your applications on it, report all and any feedback and tell us about what would you like to see in future versions. And if you would like to further enhance your GraalVM deployment you can get GraalVM Enterprise which has even better performance and includes customer support.

— GraalVM team

graalvm

Oleg Šelajev

Written by

Developer advocate for GraalVM at OracleLabs. VirtualJUG organizer. Became Java Champion in 2017. Likes programming languages, compilers, performance, chess

graalvm

graalvm

GraalVM team blog - https://www.graalvm.org

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade