/** * System.getProperty(key) * * These 5 system properties cannot be read by applets, by default. * user.name * user.dir * user.home * java.home * java.classpath * * In the appletviewer only, they can be read if the client's ~/.hotjava/properties * file sets the property key.applet=true. For example, user.name can be read * when this property is set; * user.name.applet=true * * @version JDK 1.0 beta * @author Marianne Mueller */ import java.awt.*; import java.io.*; import java.lang.*; import java.applet.*; public class getHiddenProperties extends Applet { String k1="user.name"; String k2="user.dir"; String k3="user.home"; String k4="java.home"; String k5="java.class.path"; public void paint(Graphics g) { int y = 10; try { String value = System.getProperty(k1); g.drawString(k1 + ": " + value, 10, y); } catch (SecurityException e) { g.drawString("System.getProperty(" +k1 + "): caught security exception", 10, y); } y = y + 17; try { String value = System.getProperty(k2); g.drawString(k2 + ": " + value, 10, y); } catch (SecurityException e) { g.drawString("System.getProperty(" +k2 + "): caught security exception", 10, y); } y = y + 17; try { String value = System.getProperty(k3); g.drawString(k3 + ": " + value, 10, y); } catch (SecurityException e) { g.drawString("System.getProperty(" +k3 + "): caught security exception", 10, y); } y = y + 17; try { String value = System.getProperty(k4); g.drawString(k4 + ": " + value, 10, y); } catch (SecurityException e) { g.drawString("System.getProperty(" +k4 + "): caught security exception", 10, y); } y = y + 17; try { String value = System.getProperty(k5); g.drawString(k5 + ": " + value, 10, y); } catch (SecurityException e) { g.drawString("System.getProperty(" +k5 + "): caught security exception", 10, y); } } }