property JavaAppletInitializeProperties {
requires JavaAppletInitialized;
check RSystem.initialize (args: String[]) {
util.Assert.assert (isJavaInitialized == false);
Properties props = new Properties (System.getProperties ());
// Define a number of standard properties
props.put("acl.read", "+");
props.put("acl.read.default", "");
props.put("acl.write", "+");
props.put("acl.write.default", "");
// Define which packages can be accessed by applets
props.put("package.restrict.access.sun", "true");
props.put("package.restrict.access.netscape", "true");
// Define which packages can be extended by applets
props.put("package.restrict.definition.java", "true");
props.put("package.restrict.definition.sun", "true");
props.put("package.restrict.definition.netscape", "true");
// Define which properties can be read by applets.
// A property named by "key" can be read only when its twin
// property "key.applet" is true. The following ten properties
// are open by default. Any other property can be explicitly
// opened up by the browser user setting key.applet=true in
// ~/.hotjava/properties. Or vice versa, any of the following can
// be overridden by the user's properties.
props.put("java.version.applet", "true");
props.put("java.vendor.applet", "true");
props.put("java.vendor.url.applet", "true");
props.put("java.class.version.applet", "true");
props.put("os.name.applet", "true");
props.put("os.version.applet", "true");
props.put("os.arch.applet", "true");
props.put("file.separator.applet", "true");
props.put("path.separator.applet", "true");
props.put("line.separator.applet", "true");
// User properties list
props = new Properties(props);
// Try loading the appletviewer properties file to get messages, etc.
String sep = File.separator;
File userHome = new File ("/home/salsa/evs");
File AVHome = new File(userHome, ".hotjava");
// ensure the props folder can be made
AVHome.mkdirs();
File theUserPropertiesFile = new File(AVHome, "properties");
File JH = new File(System.getProperty("java.home"));
File theAppletViewerPropsFile = new File(JH, "lib" +
sep + "appletviewer.properties");
try {
FileInputStream in =
new FileInputStream(theAppletViewerPropsFile);
props.load(new BufferedInputStream(in));
in.close();
} catch (Exception e) {
System.err.println ("Cannot load default properties file!");
}
// Try loading the saved user properties file to override some
// of the above defaults.
try {
FileInputStream in = new FileInputStream(theUserPropertiesFile);
props.load(new BufferedInputStream(in));
in.close();
} catch (Exception e) {
debugMessage ("No properties loaded, using defaults.");
}
// Install a property list.
System.setProperties (props);
// System.err.println ("Set initialized true!");
isJavaInitialized = true;
}
}
Naccio Home Page
University of Virginia, Computer Science