After successful packaging, run exe with an exception: Caused by: Java. lang. RuntimeException: Java. lang. NoClassDefFoundError: ai. onnxruntime OrtSession $SessionOptions.
When using the command: mvn - Native Native Native: compile to package as exe, an error will be reported: Error: Class path entry file:///F:/B/yolo_tiny/target/classes/ Contains class ai.onnxruntime MapInfo This class is part of the image builder itself (in file:///D:/java/graalvm -Jdk-21.0.2+13.1/lib/svm/builder/svm enterprise. jar) and must not be passed via cp. This can be caused by a fat jar that Illegally includes svm. jar (or grain sdk. jar) due to its build time dependency on it. As a workaround, - H:+AllowDeprecatedBuilderClassesOnImageClasspath allows turning this error into a warning Note that this option is deprecated and will be removed in a future version 。
============= win10 , java21
I used GraalVM 21 to package my project, which introduced the onnxruntime jar.
After successful packaging, run exe with an exception: Caused by: Java. lang. RuntimeException: Java. lang. NoClassDefFoundError: ai. onnxruntime OrtSession $SessionOptions.
======================
If commented out:
When using the command: mvn - Native Native Native: compile to package as exe, an error will be reported: Error: Class path entry file:///F:/B/yolo_tiny/target/classes/ Contains class ai.onnxruntime MapInfo This class is part of the image builder itself (in file:///D:/java/graalvm -Jdk-21.0.2+13.1/lib/svm/builder/svm enterprise. jar) and must not be passed via cp. This can be caused by a fat jar that Illegally includes svm. jar (or grain sdk. jar) due to its build time dependency on it. As a workaround, - H:+AllowDeprecatedBuilderClassesOnImageClasspath allows turning this error into a warning Note that this option is deprecated and will be removed in a future version 。
How should I handle it, may I ask? thanks!