java.lang.Object | |
↳ | java.lang.System |
Provides access to system-related information and resources including standard input and output. Enables clients to dynamically load native libraries. All methods of this class are accessed in a static way and the class itself can not be instantiated.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
PrintStream | err | Default error output stream. | |||||||||
InputStream | in | Default input stream. | |||||||||
PrintStream | out | Default output stream. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Copies the number of
length elements of the Array src
starting at the offset srcPos into the Array dest at
the position destPos . | |||||||||||
Removes a specific system property.
| |||||||||||
Returns the current system time in milliseconds since January 1, 1970
00:00:00 UTC.
| |||||||||||
Causes the virtual machine to stop running and the program to exit.
| |||||||||||
Indicates to the virtual machine that it would be a good time to run the
garbage collector.
| |||||||||||
Returns the system properties.
| |||||||||||
Returns the value of a particular system property.
| |||||||||||
Returns the value of a particular system property or
null if no
such property exists. | |||||||||||
Returns the active security manager.
| |||||||||||
Returns the value of the environment variable with the given name
var . | |||||||||||
Returns an unmodifiable map of all available environment variables.
| |||||||||||
Returns an integer hash code for the parameter.
| |||||||||||
Returns the inherited channel from the creator of the current virtual
machine.
| |||||||||||
Loads the specified file as a dynamic library.
| |||||||||||
Loads and links the shared library with the given name
libName . | |||||||||||
Returns the platform specific file name format for the shared library
named by the argument.
| |||||||||||
Returns the current timestamp of the most precise timer available on the
local system.
| |||||||||||
Provides a hint to the virtual machine that it would be useful to attempt
to perform any outstanding object finalizations.
| |||||||||||
This method is deprecated.
this method is unsafe.
| |||||||||||
Sets the standard error output stream to the given user defined output
stream.
| |||||||||||
Sets the standard input stream to the given user defined input stream.
| |||||||||||
Sets the standard output stream to the given user defined output stream.
| |||||||||||
Sets all system properties.
| |||||||||||
Sets the value of a particular system property.
| |||||||||||
Sets the active security manager.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
Default error output stream.
Default input stream.
Default output stream.
Copies the number of length
elements of the Array src
starting at the offset srcPos
into the Array dest
at
the position destPos
.
src | the source array to copy the content. |
---|---|
srcPos | the starting index of the content in src . |
dest | the destination array to copy the data into. |
destPos | the starting index for the copied content in dest . |
length | the number of elements of the array1 content they have
to be copied. |
Removes a specific system property.
key | the name of the system property to be removed. |
---|
null
if the property didn't exist.NullPointerException | if the argument key is null . |
---|---|
IllegalArgumentException | if the argument key is empty. |
SecurityException | if a security manager exists and write access to the specified property is not allowed. |
Returns the current system time in milliseconds since January 1, 1970 00:00:00 UTC. This method shouldn't be used for measuring timeouts or other elapsed time measurements, as changing the system time can affect the results.
Causes the virtual machine to stop running and the program to exit. If
runFinalizersOnExit(boolean) has been previously invoked with a
true
argument, then all all objects will be properly
garbage-collected and finalized first.
code | the return code. |
---|
SecurityException | if the running thread has not enough permission to exit the virtual machine. |
---|
Indicates to the virtual machine that it would be a good time to run the garbage collector. Note that this is a hint only. There is no guarantee that the garbage collector will actually be run.
Returns the system properties. Note that this is not a copy, so that changes made to the returned Properties object will be reflected in subsequent calls to getProperty and getProperties.
SecurityException | if a SecurityManager is installed and its checkPropertiesAccess() method does not allow the operation. |
---|
Returns the value of a particular system property. The defaultValue
will be returned if no such property has been found.
prop | the name of the system property to look up. |
---|---|
defaultValue | the return value if the system property with the given name does not exist. |
defaultValue
if the property does not exist.SecurityException | if a SecurityManager is installed and its checkPropertyAccess() method does not allow the operation. |
---|
Returns the value of a particular system property or null
if no
such property exists.
The properties currently provided by the virtual machine are:
java.vendor.url java.class.path user.home java.class.version os.version java.vendor user.dir user.timezone path.separator os.name os.arch line.separator file.separator user.name java.version java.home
prop | the name of the system property to look up. |
---|
null
if the
property doesn't exist.SecurityException | if a SecurityManager is installed and its checkPropertyAccess() method does not allow the operation. |
---|
Returns the active security manager.
Returns the value of the environment variable with the given name var
.
name | the name of the environment variable. |
---|
null
if no variable exists with the given name.SecurityException | if a SecurityManager is installed and its checkPermission() method does not allow the querying of
single environment variables. |
---|
Returns an unmodifiable map of all available environment variables.
SecurityException | if a SecurityManager is installed and its checkPermission() method does not allow the querying of
all environment variables. |
---|
Returns an integer hash code for the parameter. The hash code returned is
the same one that would be returned by the method java.lang.Object.hashCode()
, whether or not the object's class has
overridden hashCode(). The hash code for null
is 0
.
anObject | the object to calculate the hash code. |
---|
Returns the inherited channel from the creator of the current virtual machine.
null
if none exists.IOException | if an I/O error occurred. |
---|
Loads the specified file as a dynamic library.
pathName | the path of the file to be loaded. |
---|
SecurityException | if the library was not allowed to be loaded. |
---|
Loads and links the shared library with the given name libName
.
The file will be searched in the default directory for shared libraries
of the local system.
libName | the name of the library to load. |
---|
UnsatisfiedLinkError | if the library could not be loaded. |
---|---|
SecurityException | if the library was not allowed to be loaded. |
Returns the platform specific file name format for the shared library named by the argument.
userLibName | the name of the library to look up. |
---|
Returns the current timestamp of the most precise timer available on the local system. This timestamp can only be used to measure an elapsed period by comparing it against another timestamp. It cannot be used as a very exact system time expression.
Provides a hint to the virtual machine that it would be useful to attempt to perform any outstanding object finalizations.
This method is deprecated.this method is unsafe.
Ensures that, when the virtual machine is about to exit, all objects are finalized. Note that all finalization which occurs when the system is exiting is performed after all running threads have been terminated.
flag | the flag determines if finalization on exit is enabled. |
---|
Sets the standard error output stream to the given user defined output stream.
newErr | the user defined output stream to set as the standard error output stream. |
---|
SecurityException | if a SecurityManager is installed and its checkPermission() method does not allow the change of the
stream. |
---|
Sets the standard input stream to the given user defined input stream.
newIn | the user defined input stream to set as the standard input stream. |
---|
SecurityException | if a SecurityManager is installed and its checkPermission() method does not allow the change of the
stream. |
---|
Sets the standard output stream to the given user defined output stream.
newOut | the user defined output stream to set as the standard output stream. |
---|
SecurityException | if a SecurityManager is installed and its checkPermission() method does not allow the change of the
stream. |
---|
Sets all system properties.
p | the new system property. |
---|
SecurityException | if a SecurityManager is installed and its checkPropertiesAccess() method does not allow the operation. |
---|
Sets the value of a particular system property.
prop | the name of the system property to be changed. |
---|---|
value | the value to associate with the given property prop . |
null
if the property
didn't exist.SecurityException | if a security manager exists and write access to the specified property is not allowed. |
---|
Sets the active security manager. Note that once the security manager has been set, it can not be changed. Attempts to do that will cause a security exception.
sm | the new security manager. |
---|
SecurityException | if the security manager has already been set and if its checkPermission method does not allow to redefine the security manager. |
---|