I’m trying to create a lib-agent (later having to use graalvm) and I only have to use cli commands.
After using this command:
java -agentlib:native-image-agent=config-output-dir="META-INF/native-image" --module-path %MODULE_PATH% --add-modules ALL-DEFAULT,ALL-SYSTEM,ALL-MODULE-PATH --add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.iio=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.iio.commons=ALL-UNNAMED -cp "classes;lib/*" app.Main
I got this error :
Exception in thread "main" java.lang.RuntimeException: Exception in Preloader start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:883)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.IllegalStateException: Cannot load configuration class: app.spring.AppPreloaderSpringConfiguration
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:395)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:259)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:126)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:84)
at app.internal.view.preloader.FxAppPreloader.start(FxAppPreloader.java:137)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$7(LauncherImpl.java:769)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:484)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
... 1 more
Despite what is written, the Spring configuration file is present in the location indicated in the error.
I specify that when I run the program normally it works and the Spring configuration file therefore seems to be well configured.
I admit that after checking all the commands on the Oracle site (https://docs.oracle.com/en/java/javase/17/docs/specs/man/java.html) I cannot find any commands additional information to indicate the location of this configuration file.
2