The ones that are quite simple to obtain are the information accessible via the System.getProperties
(or System.getProperty
) method.
For example, os.name
will return the name of the operating system. On my system, I got the Windows XP
as the result.
Some information available by System.getProperties
, which seems to be accessible by the applet include:
java.vm.version
-- version of the JVM.
java.vm.vendor
-- vendor name of the JVM.
java.vm.name
-- name of the JVM.
os.name
-- name of the operating system. (e.g. Windows XP
)
os.arch
-- architecture of system. (e.g. x86
)
os.version
-- version of the operating system. (e.g. 5.1
)
java.specification.version
-- JRE specification version.
The above is not a comprehensive list, but it can give some ideas about what the system is like.
It should be noted that not all properties that are available through the System.getProperties
can be read, as for some properties, the security manager will cause an AccessControlException
. When I tried to read the java.home
property, an exception was thrown.
To obtain those properties which cause a AccessControlException
by default, one would probably would have to be steps taken to give permissions to the applet to perform some of those information. (Here is a link to the Security Restrictions section of the Lesson: Applets from The Java Tutorials.)
The Runtime
class can provide information such as:
Beyond the information provided by the default System
and Runtime
classes would probably require making calls to the operating system, which would be platform-dependent.
Edit
The Getting System Properties page from Lesson: Applets of The Java Tutorials provides a list of properties which can be read, and a list of properties that cannot be read by applets.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…