Previous | Next | Trail Map | Writing Applets | Creating an Applet User Interface


Reading System Properties

To find out about the current working environment, applets can read system properties. System properties are key/value pairs maintained by the System class. They contain information such as the operating system that the applet is running under.

Applets can read some, but not all, system properties. This page lists the system properties that Netscape Navigator 2.0 and the Applet Viewer allow applets to read, followed by a list of properties that applets can't read.

System Properties that Applets Can Read

Applets can read the following system properties:
Key			Meaning
-------------------	------------------------------
"file.separator"	File separator (e.g., "/")

"java.class.version"	Java class version number
"java.vendor"		Java vendor-specific string
"java.vendor.url"	Java vendor URL
"java.version"		Java version number

"line.separator"	Line separator 

"os.arch"		Operating system architecture
"os.name"		Operating system name

"path.separator"	Path separator (e.g., ":")
To read a system property from within an applet, the applet uses the System class method getProperty(). For example:
String s = System.getProperty("os.name");
To learn more about reading system properties, see the System Properties(in the Writing Java Programs trail)page.

Forbidden System Properties

For security reasons, no existing browsers or applet viewers let applets read the following system properties.
Key			Meaning
-------------------	------------------------------
"java.class.path"	Java classpath
"java.home"		Java installation directory

"user.dir"		User's current working directory
"user.home"		User home directory
"user.name"		User account name


Previous | Next | Trail Map | Writing Applets | Creating an Applet User Interface