1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 import java.util.*; 23 import java.awt.*; 24 25 /** This class prints out the system properties. 26 27 We cannot print the strings directly because of encoding issues. Since 28 about 1.3.1 one can start java with the option -Dfile.encoding=UTF-8, but 29 unfortunately this works only with later update - versions (for example, 30 1.3.1_07). Therefore we use this scheme. The property string has this form: 31 name=value 32 33 Every character is cast to an integer which value is printed, followed by a 34 space. If all characters of the string are printed, then a new line is printed. 35 */ 36 public class JREProperties 37 { main(String[] args)38 static public void main(String[] args) 39 { 40 try 41 { 42 boolean bNoAccess = false; 43 if(args.length > 0) 44 { 45 if (args[0].equals("noaccessibility")) 46 bNoAccess = true; 47 } 48 49 //Find out on what operation system we are running. On Windows 98 50 //we must not call getDefaultToolkit, because the office may freeze 51 //#i44608. 52 boolean bW98 = false; 53 String os = System.getProperty("os.name"); 54 55 if (os != null) 56 { 57 os = os.trim(); 58 if (os.equalsIgnoreCase("Windows 98") || 59 os.indexOf("Windows 98") != -1) 60 bW98 = true; 61 } 62 63 //We need to be able to switch this part off because 64 //it causes an exception if the DISPLAY variable has 65 //a false value. Setting the noaccessibility argument 66 //can be done by providing a sunjavaplugin.ini with 67 //the bootstrap parameter JFW_PLUGIN_NO_NOT_CHECK_ACCESSIBILITY 68 //set to "1" 69 if (bNoAccess == false && ! bW98) 70 { 71 try{ 72 //This line is needed to get the accessibility properties 73 Toolkit tk = java.awt.Toolkit.getDefaultToolkit(); 74 } 75 catch(Throwable e) 76 { 77 System.err.println(e); 78 } 79 } 80 81 82 Properties p = System.getProperties(); 83 Enumeration e = p.propertyNames(); 84 for (; e.hasMoreElements() ;) { 85 String sProp = (String) e.nextElement(); 86 String sCompleteProp = sProp + "=" + p.getProperty(sProp); 87 char[] arChars = new char[sCompleteProp.length()]; 88 sCompleteProp.getChars(0, sCompleteProp.length(), arChars, 0); 89 for (int c = 0; c < arChars.length; c++) { 90 System.out.print(String.valueOf((int) arChars[c])); 91 System.out.print(" "); 92 } 93 System.out.print("\n"); 94 } 95 } 96 catch(Exception e) 97 { 98 System.err.println(e); 99 } 100 101 System.exit(0); 102 } 103 104 105 106 } 107