Building native image

From oracle/graal · View interactive version

Building native image is an AI agent skill from the GitHub repository oracle/graal. Build and troubleshoot GraalVM Native Image applications. Use this skill to build Java applications with GraalVM Native Image, configure CLI options, or resolve build or runtime issues.

How to use this skill

Skill file

​# Building Native Image

Prerequisites

​

Build and Run

  1. Compile your Java file with javac.
  2. Build the Native Image:

```bash

$JAVA_HOME/bin/native-image <app-name>

```

  1. Run the resulting executable:

```bash

./app-name

```

  1. If Native Image cannot find your class file, set the classpath explicitly with the -cp option.

​

Troubleshooting

Reachability Metadata

If you encounter runtime errors related to reflection, JNI, resources, serialization, or dynamic proxies, consult CODE0 before attempting a fix. Use this reference for:

​

Native Image Options

To configure classpath, optimization level, output name, platform target, monitoring, or other CLI flags, see CODE0.

Reference Files

| Topic | File |

|-------|------|

| Native Image CLI options | references/native-image-options.md |

| Missing reachability metadata | references/reachability-metadata.md |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.