Skip to content
Skillpedia
APIs & servers (backend)22k · #10358

building-native-image

What it does

This skill guides the AI through building Java apps with GraalVM Native Image, setting build options, and fixing problems. It is for developers who want a Java program that runs as a single native executable.

When to use it

  • ✓When you need to turn a Java program into a native executable with GraalVM.
  • ✓When a Native Image build or the resulting app fails with reflection, JNI, resource, or proxy errors.
  • ✓When you want to change Native Image build options such as the classpath, output name, or optimization level.

Skill link

https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/skills/building-native-image/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/skills/building-native-image/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Help me build my Java app into a native executable with GraalVM Native Image.”

5 new skills a week. 1 minute to read.

How it works

The AI follows steps to compile the Java code, run the native-image tool, and start the result. For errors, it checks a reference guide on reflection, resources, and serialization.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

​# Building Native Image

Prerequisites

  • Set JAVA_HOME to a GraalVM distribution if your Java program uses the Native Image SDK. If you do not know the path, ask the user to provide it. ​

Build and Run

  1. Compile your Java file with javac.
  2. Build the Native Image:
    $JAVA_HOME/bin/native-image <app-name>
    
  3. Run the resulting executable:
    ./app-name
    
  4. 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 references/reachability-metadata.md before attempting a fix. Use this reference for:

  • NoClassDefFoundError or MissingReflectionRegistrationError
  • MissingJNIRegistrationError
  • MissingResourceException (missing resource bundle)
  • Any user question about reflection, JNI, proxies, resources, resource bundles, or serialization in Native Image. ​

Native Image Options

To configure classpath, optimization level, output name, platform target, monitoring, or other CLI flags, see references/native-image-options.md.

Reference Files

Topic File
Native Image CLI options references/native-image-options.md
Missing reachability metadata references/reachability-metadata.md
FAQ

Do I need GraalVM installed to use this skill?

Yes. The skill expects JAVA_HOME to point to a GraalVM distribution, and the AI will ask you for its path if it does not know it.

What kinds of errors does it help with?

It covers errors such as missing reflection registrations, missing JNI registrations, and missing resource bundles.

Can it help me change the build options?

Yes. It includes a reference of Native Image command-line options for the classpath, output name, platform target, and more.

Details

Original description by the author

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.

repo: oracle/graal

Popularity

GitHub stars
22k
Ranking position
#10358
License
—
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills