Download the JDK
Search the Tutorials
Hide the TOC
Trail: Deployment
Lesson: Applets
Section: Practical Considerations When Writing Applets
Applets
Getting Started with Applets
Importing Classes and Packages for Applets
Defining an Applet Subclass
The Life Cycle of an Applet
Methods for Milestones
Methods for Drawing and Event Handling
Methods for Adding UI Components
What Applets Can and Can't Do
Taking Advantage of the Applet API
Finding and Loading Data Files
Displaying Short Status Strings
Displaying Documents in the Browser
Sending Messages to Other Applets
Playing Sounds
Defining and Using Applet Parameters
Deciding Which Parameters to Support
Writing the Code to Support Parameters
Giving Information about Parameters
Using the APPLET Tag
Practical Considerations When Writing Applets
Security Restrictions
Creating a User Interface
Creating a GUI
Displaying Diagnostics to the Standard Output and Error Streams
Getting System Properties
Threads in Applets
Threads in Applets: Examples
Working with a Server-Side Application
A Simple Network Client Applet
Using a Server to Work Around Security Restrictions
Finishing an Applet
Before You Ship that Applet
The Perfectly Finished Applet
Deploying Applets
General Deployment Considerations
Using the applet Tag
Using the object Tag
Using the embed Tag
Deploying Applets in a Mixed-Browser Environment
Solving Common Applet Problems
Questions and Exercises
Home Page > Deployment > Applets
Getting System Properties

> To find out about the current working environment, applets can read system properties. System properties are key/value pairs that contain information such as the operating system that the applet is running under. System properties are covered in detail in the Properties page.

> Applets can read some, but not all, system properties.

### System Properties that Applets Can Read

> Applets can read the following system properties:

> Valid System Properties
> Key | Meaning
> --- | ---
> `"file.separator"` | File separator (for example, "/")
> `"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 (for example, ":")

> To read a system property from within an applet, the applet uses the `System` class method `getProperty`. For example:

> >     String newline = System.getProperty("line.separator");

> The following applet reads all of the properties that are available to all applets:

> > Sample Output

> You can find the source code in `GetOpenProperties.java`.

### Forbidden System Properties

> For security reasons, no existing browsers or applet viewers let applets read the following system properties.

> Forbidden 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 page: Displaying Diagnostics to the Standard Output and Error Streams
Next page: Threads in Applets