Java / GraalVM Interview questions
How do you generate a native executable with native-image?
The simplest path is compiling your Java source to class files, then pointing native-image at the main class.
javac HelloWorld.java native-image HelloWorld ./helloworld
For a real Maven or Gradle project, it's more common to build a fat jar first and pass that:
native-image -jar target/myapp.jar ./myapp
Common flags include --no-fallback to force a hard failure instead of a JVM fallback image, -H:+ReportExceptionStackTraces for better build-time diagnostics, and --enable-preview if the app uses preview language features. Both Maven and Gradle also have dedicated GraalVM plugins that wrap this command and integrate it into the normal build lifecycle.
More Related questions...