Skip to content

Troubleshooting

Common problems and how to fix them. See also Limitations.

UnsatisfiedLinkError when running the protected JAR

The JAR doesn't contain a native library for the platform you're running on.

  • Rebuild with a -compileFor target that matches the runtime OS and architecture.
  • To support several platforms from one JAR, list them all: -compileFor windows-x86_64,linux-x86_64,linux-aarch64.

See Running the protected JAR.

Methods aren't being protected

  • Confirm the method has the @Nativify annotation and that it's imported correctly, or run with -enable disable-annotation-check to protect all eligible methods.
  • Check the method is eligible: abstract methods, constructors (<init>), and static initializers (<clinit>) can't be protected.
  • Run with -v / --verbose to see which methods were selected.

Compilation fails with LLVM errors

  • Point Nativify at a valid LLVM install with -llvmDir.
  • Make sure the target platform is supported (see Limitations).
  • Add -v for detailed error output, and -ll <dir> to dump the generated IR for inspection.

"Feature incompatibility" error at compile time

native-unsafe and native-llvm-direct-call can't be enabled together. Enable only one. See Configuration.

The protected JAR's signature is invalid

This is expected — protecting a JAR modifies it, and Nativify removes the old signature files. Re-sign the output JAR if you need a signature. See Running the protected JAR.

A requested platform failed and the whole job failed

If any requested -compileFor target can't be built, the job fails rather than shipping a JAR that references a missing native library. Request only the platforms you can build (you may need a cross-toolchain for Windows/macOS from another host), or build a separate JAR per platform group.

Build issues (building Nativify itself)

Problem Fix
Changes not taking effect Use mvn clean install, not just compile.
UnsatisfiedLinkError during build/run of the tool Ensure -Djavacpp.platform matches your host system.

See Building from source.