Java

GraalVM can execute Java applications in the Java HotSpot VM using Graal as the just-in-time compiler.


What are key benefits of GraalVM executing Java?

Graal focuses on providing excellent peak performance for long-running and complex Java applications. While we are still working on further improving the performance of Graal on traditional workloads, there are already programs for which Graal provides better peak performance than existing compilers. In particular, applications using non-traditional bytecode patterns (e.g., Scala applications, heavy Stream API and lambda users) benefit from Graal. There are three main factors contributing to Graal’s peak performance results:

  • New approach to inlining: Graal uses a novel way of inlining that does not take Java bytecode size into account and instead simulates the benefits of inlining before making a final decision.

  • Partial escape analysis: Graal is able to remove object allocations by either completely proving the thread-locality of an object or by sinking allocations into less frequently executed branches.

  • Speculative optimizations: A main component of the compiler’s design is first-class support for speculative optimizations. This benefits in particular the execution of dynamic languages on top of Graal.


How can I execute Java applications on the GraalVM?

GraalVM provides a compiler and execution system (virtual machine) for Java applications. You can execute any Java program as you can with other Java VMs using a command-line shell.

# export PATH=/path/to/graalAndTruffle/bin:$PATH
# java myJavaClass
or
# java -jar myJavaApp.jar

You can verify that you are using GraalVM with the command java -version. The output should contain "Graal VM" as shown here:

# java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
OpenJDK 64-Bit Graal VM (build ...)

For more details, see the README file in the release.