# Building Native Image
Prerequisites
- Set
JAVA_HOMEto 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
- Compile your Java file with
javac. - Build the Native Image:
```bash
$JAVA_HOME/bin/native-image <app-name>
```
- Run the resulting executable:
```bash
./app-name
```
- If Native Image cannot find your class file, set the classpath explicitly with the
-cpoption.
Troubleshooting
Reachability Metadata
If you encounter runtime errors related to reflection, JNI, resources, serialization, or dynamic proxies, consult