javajava-native-interfacegraalvmjava-native-library

GrallVM native-image build error "java.lang.NoSuchMethodException: sun.invoke.util.ValueConversions.booleanToİnt(boolean)"


I have a java application. This application calls the "square" method of the library shared with JNA and prints the result to the console. Things work fine when running the jar file, but when trying to compile the jar file with the "native-image" command, "Fatal error: org.graalvm.compiler.debug.GraalError: com.oracle.svm.util.ReflectionUtil$ReflectionUtilError: java.lang.NoSuchMethodException" I get an error like ": sun.invoke.util.ValueConversions.booleanToInt(boolean)". When I first look, I see the letter "I" in the method name. I think the error might be here but I don't know how to fix it.

Note: jdk version: graalvm-jdk-17.0.9

here are some images:

folder structure

pom.xml

console output

How can I deal with this?

successful native image build but get an error


Solution

  • Try running native-image in any English (UK, US) locale, that should fix the error.

    Next, you might want to file a bug against GraalVM not working properly in Turkish locale. It seems an error on their side: they are calling toUpperCase with no locale argument, which uses system locate by default. This works in most cases, but produces surprising results in Turkish locale (and javadoc for this method even discusses this very case)