◀Table of Contents
Getting Started with GraalVM
GraalVM compiles your Java applications ahead of time into standalone binaries that start instantly, provide peak performance with no warmup, and use fewer resources.
Here you will find information about installing GraalVM and running basic applications with it.
If you are new to GraalVM, we recommend starting with the introduction to GraalVM, where you will find information about GraalVM’s benefits, distributions available, supported platforms, features support, and licensing.
If you have GraalVM already installed and have experience using it, you can skip this page and proceed to the in-depth reference manuals.
Choose your operating system and proceed to the installation steps for your specific platform:
Start Running Applications
GraalVM includes the Java Development Kit (JDK), the just-in-time compiler (the Graal compiler), Native Image, and standard JDK tools. You can use the GraalVM JDK just like any other JDK in your IDE, so having installed GraalVM, you can run any Java application unmodified.
The java
launcher runs the JVM with Graal as the last-tier compiler.
Check the installed Java version:
$JAVA_HOME/bin/java -version
Using GraalVM Native Image you can compile Java bytecode into a platform-specific, self-contained native executable to achieve faster startup and a smaller footprint for your application.
Compile this simple HelloWorld.java application to bytecode and then build a native executable:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
javac HelloWorld.java
native-image HelloWorld
The last command generates an executable file named helloworld in the current working directory.
Invoking it runs the natively compiled code of the HelloWorld
class as follows:
./helloworld
Hello, World!
Note: For compilation
native-image
depends on the local toolchain. Make sure your system meets the prerequisites.
What to Read Next
New Users
Continue to Native Image basics for more information about the technology. For users who are familiar with GraalVM Native Image but may have little experience using it, proceed to User Guides.
For more information on the Graal compiler, see the compiler documentation. Larger Java examples can be found in the GraalVM Demos repository on GitHub.
Advanced Users
Developers who are more experienced with GraalVM or want to do more with GraalVM can proceed directly to Reference Manuals for in-depth documentation.
You can find information on GraalVM’s security model in the Security Guide, and rich API documentation in the GraalVM SDK Javadoc and Truffle Javadoc.
We also recommend checking our GraalVM Team Blog.