Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of JavaLessons.com
Environment variables can be retrieved by using System.getProperty.
Strings are returned and added to a TextArea. A tab character, \t , is used to embellish what's shown in the TextArea.
The Java vendor property doesn't show in the TextArea, it can be seen in the Java console window.
For applets in browsers the console can be opened this way :
Sun's plugin : right-click icon in system tray, Open Console
Opera : Tools, Advanced, Java console
With stand-alone applications you already have a console window, the one from which the app was started.
System.out.println is useful when debugging an application, to see which methods are executed, inspect variables, verify that you're testing the right version ( ! ), show error messages ,etc.
DON'T use it to inform the user.
The showStatus method can only be used in applets and should only be used for messages that are not important. There's no guarantee, that the browser's statusbar is enabled and, if it is, that the user looks at it. Sometimes convenient while developing.
In addition to he ones shown, here are some other properties :
For security reasons, the following can not be retrieved from regular applets, but they can be from stand-alone applications, that operate without a browser, or from signed and approved applets :
It's possible to set your own properties during runtime, but keep in mind that they're temporary and only apply to the process at hand. Take care not to overwrite properties unwittingly.
To see all properties.
To get a string at all times, even if the key isn't found.
All methods of the System class can be called by writing the name of the class, System, followed by a dot and the name of the method. This is explained in the 'Static' lesson.
In most cases \t is not suitable for creating a column layout, because it's not possible to change the tab settings.