<AWT Dev> RFR: 8027912: [macosx] Provide means to force the headful mode on OS X when running via ssh

Artem Ananiev artem.ananiev at oracle.com
Fri Nov 8 00:27:18 PST 2013


On 11/8/2013 12:42 AM, Anthony Petrov wrote:
> It's funny how TRUETRUE does the trick :)
>
> Anyway, the fix looks fine to me. Thanks for resolving this issue.
>
> Sergey, and/or Artem, could you please review it, too? We need this fix
> in JDK 8.

The changes look fine to me.

I'm not a big fan of adding more env variables, though. We've just got 
rid of AWT_TOOLKIT, but now are about to introduce AWT_FORCE_HEADFUL. 
Are there any alternatives? What about

   java -Djava.awt.headless=false -jar ...

? I don't say it's the best option, of course, as handling missing and 
false values differently can be confusing, but it doesn't introduce new 
system properties or env vars.

Thanks,

Artem

> PS. I'll push this fix if David doesn't have commit rights to the awt-gate.
>
> --
> best regards,
> Anthony
>
> On 11/08/2013 12:20 AM, David DeHaven wrote:
>>
>> Quick fix to reenable some automated testing that was broken by my
>> recent fix to disable the X11 toolkit.
>>
>>
>> diff --git a/src/solaris/native/java/lang/java_props_macosx.c
>> b/src/solaris/native/java/lang/java_props_macosx.c
>> --- a/src/solaris/native/java/lang/java_props_macosx.c
>> +++ b/src/solaris/native/java/lang/java_props_macosx.c
>> @@ -106,6 +106,12 @@
>>   }
>>
>>   int isInAquaSession() {
>> +    // environment variable to bypass the aqua session check
>> +    char *ev = getenv("AWT_FORCE_HEADFUL");
>> +    if (ev && (strncasecmp(ev, "true", 4) == 0)) {
>> +        // if "true" then tell the caller we're in an Aqua session
>> without actually checking
>> +        return 1;
>> +    }
>>       // Is the WindowServer available?
>>       SecuritySessionId session_id;
>>       SessionAttributeBits session_info;
>>
>>
>>
>>
>> Quick sanity check over a SSH session (where isInAquaSession was
>> returning false):
>>
>> jdk8-deploy daved$ AWT_FORCE_HEADFUL=false
>> ./build/macosx-x86_64-normal-server-release/jdk/bin/java -jar
>> ~/Desktop/SwingSet2.jar
>> 2013-11-07 12:13:21.647 java[5088:707] [JRSAppKitAWT markAppIsDaemon]:
>> Process manager already initialized: can't fully enable headless mode.
>> Exception in thread "main" java.awt.HeadlessException
>>     at
>> sun.java2d.HeadlessGraphicsEnvironment.getDefaultScreenDevice(HeadlessGraphicsEnvironment.java:77)
>>
>>     at SwingSet2.main(SwingSet2.java:224)
>>
>> jdk8-deploy daved$ AWT_FORCE_HEADFUL=true
>> ./build/macosx-x86_64-normal-server-release/jdk/bin/java -jar
>> ~/Desktop/SwingSet2.jar
>>
>> jdk8-deploy daved$ AWT_FORCE_HEADFUL=True
>> ./build/macosx-x86_64-normal-server-release/jdk/bin/java -jar
>> ~/Desktop/SwingSet2.jar
>>
>> jdk8-deploy daved$ AWT_FORCE_HEADFUL=TRUE
>> ./build/macosx-x86_64-normal-server-release/jdk/bin/java -jar
>> ~/Desktop/SwingSet2.jar
>>
>> jdk8-deploy daved$ AWT_FORCE_HEADFUL=TRUETRUE
>> ./build/macosx-x86_64-normal-server-release/jdk/bin/java -jar
>> ~/Desktop/SwingSet2.jar
>>
>> jdk8-deploy daved$ AWT_FORCE_HEADFUL=AKASKLJ
>> ./build/macosx-x86_64-normal-server-release/jdk/bin/java -jar
>> ~/Desktop/SwingSet2.jar
>> 2013-11-07 12:14:04.606 java[5138:707] [JRSAppKitAWT markAppIsDaemon]:
>> Process manager already initialized: can't fully enable headless mode.
>> Exception in thread "main" java.awt.HeadlessException
>>     at
>> sun.java2d.HeadlessGraphicsEnvironment.getDefaultScreenDevice(HeadlessGraphicsEnvironment.java:77)
>>
>>     at SwingSet2.main(SwingSet2.java:224)
>>
>> jdk8-deploy daved$
>> ./build/macosx-x86_64-normal-server-release/jdk/bin/java -jar
>> ~/Desktop/SwingSet2.jar
>> 2013-11-07 12:14:18.351 java[5154:707] [JRSAppKitAWT markAppIsDaemon]:
>> Process manager already initialized: can't fully enable headless mode.
>> Exception in thread "main" java.awt.HeadlessException
>>     at
>> sun.java2d.HeadlessGraphicsEnvironment.getDefaultScreenDevice(HeadlessGraphicsEnvironment.java:77)
>>
>>     at SwingSet2.main(SwingSet2.java:224)
>>
>> (SwingSet2 ran normally in the runs that did not produce a
>> HeadlessException)
>>
>> -DrD-
>>


More information about the awt-dev mailing list