On Wed, 9 Dec 2020 00:14:23 GMT, Andrii Rodionov 
<github.com+1538227+arodio...@openjdk.org> wrote:

> No, we produce only one image. The headless/non-headless mode is defined by 
> the system property `-Djava.awt.headless=...`.
> Here is a command example for native image generation:
> `$ ~/graalvm-ce-java11-21.0.0-dev/bin/native-image 
> -H:ConfigurationFileDirectories=./configs -Djava.awt.headless=true 
> AWTFixExample`
> 
> With `-Djava.awt.headless=false` to the gcc linker we pass `libawt.a` and 
> `libawt_headless.a`
> With `-Djava.awt.headless=true` to the gcc linker we pass `libawt.a` and 
> `libawt-xawt.a`
> If the generated image demands `libmlib_image.a` it will be also linked.

-Djava.awt.headless is a runtime property not a build time property. So you are 
doing domething very weird.
How does that image with "false" run a UI app ? It can't. And yet the one with 
"true" still can run without an xserver, except it will not start unless you 
have X11 libs installed - and I am *reasonably* sure you aren't statically 
linking all the system provided libraries ... I hope ...

So how does a "user" use all of this ? Seems they must create their own app by 
native compile + linking.
Can they create an image that can run any java app, or must the app like 
AWTFixExample be linked in to the image ?

-------------

PR: https://git.openjdk.java.net/jdk/pull/562

Reply via email to