Update ooo320-m1
[ooovba.git] / jvmfwk / plugins / sunmajor / pluginlib / JREProperties.java
blob28b67945ac780e5794ac0572832e388467f76ef0
1 import java.util.*;
2 import java.awt.*;
4 /** This class prints out the system properties.
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
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.
15 public class JREProperties
17 static public void main(String[] args)
19 try
21 boolean bNoAccess = false;
22 if(args.length > 0)
24 if (args[0].equals("noaccessibility"))
25 bNoAccess = true;
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");
34 if (os != null)
36 os = os.trim();
37 if (os.equalsIgnoreCase("Windows 98") ||
38 os.indexOf("Windows 98") != -1)
39 bW98 = true;
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)
50 try{
51 //This line is needed to get the accessibility properties
52 Toolkit tk = java.awt.Toolkit.getDefaultToolkit();
54 catch(Throwable e)
56 System.err.println(e);
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(" ");
72 System.out.print("\n");
75 catch(Exception e)
77 System.err.println(e);
80 System.exit(0);