You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import java.awt.Font;
import java.awt.GraphicsEnvironment;
public class Main {
public static void main(String[] args) {
for (Font font : GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts()) {
System.out.printf("%s, %s\n", font.getFontName(), font.getFamily());
}
}
}
compiled as:
export JAVA_HOME=/home/karm/tmp/graal-labsjava11-build;export GRAALVM_HOME=${JAVA_HOME};export PATH=${JAVA_HOME}/bin:${PATH}
javac Main.java
java -agentlib:native-image-agent=config-output-dir=./META-INF/native-image Main
native-image --no-fallback --initialize-at-build-time= -H:DeadlockWatchdogInterval=2 --native-image-info --verbose Main
produces either an occasional deadlock on my system, see deadlock log or it crashes later during the build on undefined reference to `Java_sun_font_Freetype*, see log.
See also the discussion on #3417 for more details.
Summary: Initializing all classes at image build time for AWT/Swing is not feasible at this time. It would require quite extensive patching of the JDK code, which cannot be done in a maintainable way using substitutions. The only proper way would be to make changes to the JDK itself, i.e., contribute to OpenJDK.
Since there is no need to use --initialize-at-build-time=, removing that from the native-image command line is the recommended solution for now.
Describe the issue
The following code, Main.java:
compiled as:
produces either an occasional deadlock on my system, see deadlock log or it crashes later during the build on
undefined reference to `Java_sun_font_Freetype*
, see log.Describe GraalVM and your environment:
The text was updated successfully, but these errors were encountered: