1 import java.util.*; 2 import java.awt.*; 3 4 /** This class prints out the system properties. 5 6 We cannot print the strings directly because of encoding issues. Since 7 about 1.3.1 one can start java with the option -Dfile.encoding=UTF-8, but 8 unfortunately this works only with later update - versions (for example, 9 1.3.1_07). Therefore we use this scheme. The property string has this form: 10 name=value 11 12 Every character is cast to an integer which value is printed, followed by a 13 space. If all characters of the string are printed, then a new line is printed. 14 */ 15 public class JREProperties 16 { 17 static public void main(String[] args) 18 { 19 try 20 { 21 boolean bNoAccess = false; 22 if(args.length > 0) 23 { 24 if (args[0].equals("noaccessibility")) 25 bNoAccess = true; 26 } 27 28 //Find out on what operation system we are running. On Windows 98 29 //we must not call getDefaultToolkit, because the office may freeze 30 //#i44608. 31 boolean bW98 = false; 32 String os = System.getProperty("os.name"); 33 34 if (os != null) 35 { 36 os = os.trim(); 37 if (os.equalsIgnoreCase("Windows 98") || 38 os.indexOf("Windows 98") != -1) 39 bW98 = true; 40 } 41 42 //We need to be able to switch this part off because 43 //it causes an exception if the DISPLAY variable has 44 //a false value. Setting the noaccessibility argument 45 //can be done by providing a sunjavaplugin.ini with 46 //the bootstrap parameter JFW_PLUGIN_NO_NOT_CHECK_ACCESSIBILITY 47 //set to "1" 48 if (bNoAccess == false && ! bW98) 49 { 50 try{ 51 //This line is needed to get the accessibility properties 52 Toolkit tk = java.awt.Toolkit.getDefaultToolkit(); 53 } 54 catch(Throwable e) 55 { 56 System.err.println(e); 57 } 58 } 59 60 61 Properties p = System.getProperties(); 62 Enumeration e = p.propertyNames(); 63 for (; e.hasMoreElements() ;) { 64 String sProp = (String) e.nextElement(); 65 String sCompleteProp = sProp + "=" + p.getProperty(sProp); 66 char[] arChars = new char[sCompleteProp.length()]; 67 sCompleteProp.getChars(0, sCompleteProp.length(), arChars, 0); 68 for (int c = 0; c < arChars.length; c++) { 69 System.out.print(String.valueOf((int) arChars[c])); 70 System.out.print(" "); 71 } 72 System.out.print("\n"); 73 } 74 } 75 catch(Exception e) 76 { 77 System.err.println(e); 78 } 79 80 System.exit(0); 81 } 82 83 84 85 } 86