Skip to content

This repository contains example applications to illustrate the different capabilities of GraalVM

License

Notifications You must be signed in to change notification settings

graalvm/graalvm-demos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraalVM Demos

This repository contains demo applications and benchmarks written in Java, JavaScript, Python, and other languages. These applications illustrate the diverse capabilities of GraalVM.

The demos are sorted by a framework, by a programming language, or by a technology. Each directory contains demo sources; the instructions on how to run a particular demo are in its README.md file. To get started, clone or download this repository, enter the demo directory, and follow steps in the README.md file.

git clone https://github.com/graalvm/graalvm-demos.git
cd graalvm-demos

GraalVM JDK and Native Image

Name Description
tiny-java-containers
tiny-java-containers
Demonstrates how to build very small Docker container images with GraalVM Native Image and various lightweight base images.
Technologies: Native Image, musl libc
Reference: Static and Mostly Static Images
native-image/hello-world
native-image/hello-world
Demonstrates how to build native executables from a class file and a JAR file from the command line
Technologies: Native Image
Reference: Native Image Getting Started
java-hello-world-maven
java-hello-world-maven
Demonstrates how to generate a native executable using the Native Build Tools Maven plugin
Technologies: Native Image, Native Build Tools Maven plugin
Reference: Oracle GraalVM in OCI Code Editor
native-image/build-java-modules
build-java-modules
Demonstrates how to build a modular Java application into a native executable
Technologies: Native Image, Maven
Reference: Build Java Modules into a Native Executable
native-image/list-files
native-image/list-files
Demonstrates how to compile a CLI application into a native executable and then apply Profile-Guided Optimizations (PGO) for more performance gains
Technologies: Native Image, PGO
multithreading-demo
streams
Demonstrates how to optimize a Java application that does synchronous and asynchronous threads execution
Technologies: Native Image Build Reports, Native Build Tools Maven plugin
Reference: Making sense of Native Image contents
javagdbnative
javagdbnative
Demonstrates how to debug a Java application, built into a native executable in VS Code
Technologies: Native Image, Maven, GraalVM Tools for Java
Reference: Native Image Debugging in VS Code
native-image/add-logging
add-logging
Demonstrates how to initialize Loggers with Native Image at the executable build or run time
Technologies: Native Image
Reference: Add Logging to a Native Executable
native-image/add-jfr
add-jfr
Demonstrates how to create a custom JDK Flight Recorder (JFR) event and use that in a native executable
Technologies: Native Image, JFR, VisualVM
Reference: Build and Run Native Executables with JFR
native-image/build-shared-library
build-shared-library
Demonstrates how to create a Java class library, use Native Image to create a native shared library, and then create a small C application that uses that shared library
Technologies: Native Image, LLVM toolchain
Reference: Build a Native Shared Library
native-image/configure-with-tracing-agent
configure-with-tracing-agent
Demonstrates how to provide metadata for Native Image in the form of JSON configuration files using a tracing agent
Technologies: Native Image
native-image/build-static-images
build-static-images
Demonstrates how to build a fully static and a mostly-static native executable.
Technologies: Native Image
Reference: Build a Statically Linked or Mostly-Statically Linked Native Executable
native-image/create-heap-dumps
native-image/create-heap-dumps
Demonstrates different ways to generate a heap dump from a running native executable.
Technologies: Native Image, VisualVM
Reference: Create a Heap Dump from a Native Executable
native-image/add-jmx
add-jmx
This demo covers the steps required to build, run, and interact with a native executable using JMX.
Technologies: Native Image, JMX, VisualVM
Reference: Build and Run Native Executables with Remote JMX

Native Image on Cloud Platforms

Name Description
clouds/native-aws-fargate
clouds/native-aws-fargate
This demo covers the steps required to create a container image of a native executable application and deploy the image on AWS Fargate.
Technologies: Native Image, Apache Maven, Docker, AWS Fargate
clouds/native-aws-lambda
clouds/native-aws-lambda
This demo covers the steps required to deploy a native executable application on AWS Lambda.
Technologies: Native Image, Apache Maven, Docker, AWS Lambda
clouds/native-google-cloud-run
clouds/native-google-cloud-run
This demo covers the steps required to create a container image of a native executable application and deploy the image on Google Cloud Run.
Technologies: Native Image, Apache Maven, Docker, Google Cloud CLI, Google Cloud Run
clouds/native-oci-container-instances
clouds/native-oci-container-instances
This demo covers the steps required to create a container image of a native executable application and deploy the image on OCI Container Instances.
Technologies: Native Image, Apache Maven, Docker, OCI Container Instances
clouds/native-oci-generative-ai
clouds/native-oci-generative-ai
This demo covers the steps required to use the Generative AI service provided by Oracle Cloud Infrastructure. It uses a state-of-the-art, customizable large language model to generate text.
Technologies: Native Image, Apache Maven, Generative AI

Micronaut

Name Description
micronaut-hello-rest-maven
micronaut-hello-rest-maven
Demonstrates how to package a Micronaut REST application into a native executable with Native Build Tools Maven plugin
Technologies: Native Image, Micronaut, Native Build Tools Maven plugin
Reference: Try in OCI Code Editor

Spring Boot

Name Description
native-image/containerize
native-image/containerizee
Demonstrates how to compile a Spring Boot 3 application into a native executable using the Native Build Tools Maven plugin and a Maven profile
Technologies: Spring Boot, Native Image, Native Build Tools Maven plugin
Reference: Containerize a Native Executable and Run in a Container, Oracle GraalVM in OCI Cloud Shell

Scala

Name Description
scalac-native Demonstrates how to build a native executable of the Scala compiler. The resulting binary has no dependencies on the JDK.
Technologies: Scala 2.12.x, Native Image
Reference: Compiling Scala Faster with GraalVM

Polyglot

Name Description
polyglot-chat-app
polyglot-chat-app
Demonstrates how to build a polyglot chat application by embedding Python and R into the Java host language
Technologies: Java, GraalPy, FastR, Micronaut
polyglot-debug
polyglot-debug
Demonstrates how to debug a polyglot Java and JavaScript application using GraalVM Tools for Java in VS Code
Technologies: Java, JavaScript, Maven, GraalVM Extension Pack
functionGraphDemo
functionGraphDemo
Demonstrates how to run a polyglot JavaScript-Java-R application on the GraalVM Node.js runtime
Technologies: JavaScript, Node.js, Java, R

Compatibility

The demos are normal applications and benchmarks written in Java, JavaScript, Python, etc., so they are compatible with any virtual machine capable of running Java, JavaScript and so on. These demos are tested against the latest GraalVM release using GitHub Actions. If you come across an issue, please submit it here.

License

Unless specified otherwise, all code in this repository is licensed under the Universal Permissive License (UPL). Note that the submodule fastR-examples which is a reference to the graalvm/examples repository has a separate license.

Learn More

About

This repository contains example applications to illustrate the different capabilities of GraalVM

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published