On 9 May 2006 17:20:23 -0700, ""
<> wrote, quoted or indirectly quoted someone
who said :
>
>Any ideas?
here is my code from Wassup that does the same thing:
/**
* Get a sorted list of all the system properties. Only works in
* applications and signed Applets.
*
* @param separator usually "\n\n"
*
* @return String contaning pairs of property-value
*/
public static String displayAllProperties( String separator )
{
try
{
Properties sysprops = System.getProperties();
// Count properties
int count = sysprops.size();
// prepare Matrix to hold the properties
String[][] matrix = new String[ count ][ 2 ];
// read System properties into the matrix
int j = 0; // Java won't let me put this in the for loop,
Ouch!
for ( Enumeration e = sysprops.propertyNames(); j < count;
j++ )
{
String key = (String) e.nextElement();
String value = sysprops.getProperty( key );
matrix[ j ][ 0 ] = key;
matrix[ j ][ 1 ] = value;
} // end for
// sort by key
Arrays.sort( matrix, new StringComparator() );
// concatenate all key value pairs.
StringBuffer result = new StringBuffer( 4096 );
for ( int i = 0; i < count; i++ )
{
String key = matrix[ i ][ 0 ];
if ( key != null )
{
String value = matrix[ i ][ 1 ];
if ( value != null )
{
if ( value.equals( "\r\n" ) )
{
value = "[hex chars: 0x0d 0x0a i.e. CrLf,
\\r\\n]";
}
else if ( value.equals( "\n" ) )
{
value = "[hex char: 0x0a i.e. Lf, \\n]";
}
else if ( value.equals( "\r" ) )
{
value = "[hex char: 0x0d i.e. Cr, \\r]";
}
result.append( key );
result.append( " = " );
result.append( value );
result.append( separator );
}
}
} // end for
return result.toString();
}
catch ( Exception e )
{
return "No security clearance to see the restricted System
properties.";
}
} // end displayAllProperties
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.