oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.34k stars 1.63k forks source link

[Native Image] ClassNotFoundException #9930

Open Ferrarisrex opened 2 days ago

Ferrarisrex commented 2 days ago

Describe the Issue

I package and compile the jar using the maven native image plugin, and the output works fine on the computer that compiled it, even if i change the executables directory, however, if i put it on a different computer, I get java.lang.ClassNotFoundException: com.sun.prism.shader.Mask_TextureSuper_Loader i did bring all the DLL files with it, and the target computer has java 1.8

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

java version "21.0.4" 2024-07-16 LTS Java(TM) SE Runtime Environment Oracle GraalVM 21.0.4+8.1 (build 21.0.4+8-LTS-jvmci-23.1-b41) Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.4+8.1 (build 21.0.4+8-LTS-jvmci-23.1-b41, mixed mode, sharing)

Operating System and Version

Windows 10 22h2

Diagnostic Flag Confirmation

Run Command

image.exe

Expected Behavior

to finish running

Actual Behavior

opens a menu, and then has the above error constantly reoutputted to the command prompt and does not continue

Steps to Reproduce

  1. Run the file

Additional Context

No response

Run-Time Log Output and Error Messages

No response

Karm commented 1 day ago

@Ferrarisrex Help us help you with a small reproducer, an application you can share that demonstrates this behavior. You most definitely need libraries from the GraalVM distro, not anything pulled from Java 1.8.

Ferrarisrex commented 1 day ago

I can not reproduce the error without the code I already made, so I do not know the app works fine on computers that compile it, but if I open up a VM of the same OS on that pc, I get that error. is there any way to make sure that the class is included in reflection? it doesn't seem to work with the automatic reflection generator

Ferrarisrex commented 1 day ago

I tried fixing it by just copying the format of the other shaders in reflect-config.json, but that results in a InvocationTargetExcaption

Ferrarisrex commented 13 hours ago

I tried it differently, doing: name: com.sun.prism.shader.Mask_TextureSuper_Loader allDeclaredClasses: true allPublicClasses: true but it says method not found com.sun.prism.shader.Mask_TextureSuper_Loader.loadShader()

Ferrarisrex commented 11 hours ago

if I do -H:IncludeResources=".*" it works, but the file size is huge, but if i do -H:IncludeResources="com.sun.prism.shader.Mask_TextureSuper_Loader.class" it does not work