Replies: 1 comment 2 replies
-
We don't support it explicitly. You can use the micronaut framework with AWT and native image in principle, but you're on your own in making AWT compatible with native image. You will need to configure reflection to work properly with AWT. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone, I need to provide captcha functionality in my web project, so I can only use awt to generate images. I successfully compiled my project using native images, but when it runs, it prints a log, such as' Cannot find class java. awt. GraphicsEnvironment $LocalGE 'or' Cannot find class Sun. awt. X11GraphicsEnvironment '.
I searched on Google and the grailvm document shows that native images now support AWT, but it requires the project to provide jni config.json and more.
Therefore, I generated these files using the command "java agentlib: native image agent=config output dir =XXX jar YYYY. jar" and added them to my project. At the same time, I added the attribute "<micronaut. nature image. args>" to add native image parameters, such as "- H: JNIConfigurationFiles=XXX".
After I added the configuration file, I compiled using mvn package -Dpackaging=docker-native -Pgraalvm and encountered some errors:/usr/bin/ld: cannot find - lfretype.Then I installed freetype and fontconfig lib in the native Docker image and used registry. access. redhat. com/ubi8/ubi minimal: 8.6 (follow Quarkus instructions to install freetype and fontconfig,link is https://quarkus.io/guides/quarkus-runtime-base-image )as the basic image of my project, the compilation was successful and I get the Docker image of my project.
However, the Docker image will print the same error log "Unable to find this class Sun. awt. X11GraphicsEnvironment".
So, I don't know if Micronaut supports awt, or how to use awt correctly in Micronaut when using native images?My Mirconaut version is 3.8.8 and I use Java 11.
Sombody can help me? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions