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

Anthony Petrov anthony.petrov at oracle.com
Fri Nov 8 08:10:04 PST 2013


I've just pushed the fix to the build-gate (because awt-gate isn't yet 
synced with latest changes from David):

http://hg.openjdk.java.net/jdk8/build/jdk/rev/43168d403243

--
best regards,
Anthony

On 11/08/2013 04:32 PM, Artem Ananiev wrote:
>
> On 11/8/2013 3:19 PM, Anthony Petrov wrote:
>> Hi Artem,
>>
>> The problem here is that Java properties aren't yet available when the
>> isAquaSession() check is being performed. Hence we can only use an
>> environment variable here.
>>
>> I'll be pushing the fix later today if no objections.
>
> OK.
>
> Thanks,
>
> Artem
>
>> --
>> best regards,
>> Anthony
>>
>> On 11/08/2013 12:27 PM, Artem Ananiev wrote:
>>>
>>> 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