jtreg does not pass the GNOME_DESKTOP_SESSION_ID system variable to the tested JDK

Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Fri Oct 21 02:49:37 PDT 2011


Hi,

The  UIManager.getSystemLookAndFeelClassName() runnning in the test 
method by jtreg returns different L&Fs than  it is run under JDK on the 
Solaris when the GNOME_DESKTOP_SESSION_ID is set.
It is because the jtreg does not pass the  GNOME_DESKTOP_SESSION_ID 
system variable to the tested JDK and so the JDK does not set the 
sun.desktop system variable.

To check this set the GNOME_DESKTOP_SESSION_ID system variable on the 
Solaris and run the following code under java 1.7  and jtreg:
--- TestSunDesktopSystemVariable.java ---
/*
  * @test
  * @summary Check that sun.desktop variable is set in JDK if the 
GNOME_DESKTOP_SESSION_ID system variable is set on Solaris OS
  * @run main TestSunDesktopSystemVariable
  */

public class TestSunDesktopSystemVariable {

     public static void main(String[] args) {
         String sunDesktop = System.getProperty("sun.desktop");
         System.out.println("desktop = " + sunDesktop);

         if(sunDesktop == null){
             throw new RuntimeException("The sun.desktop system variable 
is not set");
         }
     }
}
---------------------------------------------------
The result is
 > java
   desktop = gnome
 > jtreg
   ----------System.out:(1/15)----------
    desktop = null
    ----------System.err:(13/814)----------
    java.lang.RuntimeException: The sun.desktop system variable is not set


To fix this the GNOME_DESKTOP_SESSION_ID system variable should be added 
to the DEFAULT_UNIX_ENV_VARS string array in the 
com.sun.javatest.regtest.Main class.

Thanks,
Alexandr.




More information about the jtreg-use mailing list