-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Headless property is baked in, can no longer run heady #3064
Comments
@kristofdho please provide reproducer |
file: BakedInHeadlessPoc.java import java.awt.GraphicsEnvironment;
class BakedInHeadlessPoc {
public static void main(String[] args) throws Exception {
System.out.println(GraphicsEnvironment.isHeadless());
}
} compile & build: javac BakedInHeadlessPoc.java
native-image -H:Name=BakedInHeadlessPoc -H:Class=BakedInHeadlessPoc --verbose --no-fallback run compiled binary: > BakedInHeadlessPoc.exe
true
> BakedInHeadlessPoc.exe -Djava.awt.headless=true
true
> BakedInHeadlessPoc.exe -Djava.awt.headless=false
true expected output: > BakedInHeadlessPoc.exe
false
> BakedInHeadlessPoc.exe -Djava.awt.headless=true
true
> BakedInHeadlessPoc.exe -Djava.awt.headless=false
false marking suggested fix in #3068 |
Should this not be included in the 21.0 milestone as well? It is regression so it would make sense. |
I would like to restate the importance of this regression for us. Could I have some context on why this is not making 21.0, and what a possible workaround would be? |
@kristofdho, I wouldn't necessarily call this a regression, because AWT is not yet supported on Windows (see #3084), but I also agree that this plugin should not be needed. So until this is fixed, you can pass > native-image -H:Name=BakedInHeadlessPoc -H:Class=BakedInHeadlessPoc --verbose --no-fallback -Djava.awt.headless=false
...
> BakedInHeadlessPoc
false
> BakedInHeadlessPoc -Djava.awt.headless=true
false
> BakedInHeadlessPoc -Djava.awt.headless=false
false |
Can someone please add the |
@zakkak done |
Thank you @mcraj017 ! |
Describe the issue
The awt invocation plugin causes the headless property to be stored at build-time, which means you can no longer switch between headless and heady execution at runtime. Since on windows,
-Djava.awt.headless=true
is set by native-image itself, this breaks any heady application.The plugin seems to be directed at unix environments, as that's also the only awt support that's already added, so it might make sense to only conditionally add the plugin if we're targetting unix.
Additionally I think it's not preferable to have to decide at build-time if the application will run headless or heady.
The invocation plugin this is about:
graal/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/snippets/SubstrateGraphBuilderPlugins.java
Lines 1033 to 1048 in 6fc5aaf
Steps to reproduce the issue
-Djava.awt.headless=false
and it will still be headlessDescribe GraalVM and your environment:
The text was updated successfully, but these errors were encountered: