Documentos de Académico
Documentos de Profesional
Documentos de Cultura
PACKAGE
CLASS
USE
TREE
FRAMES
DEPRECATED
NO FRAMES
INDEX HELP
Java Platform
Standard Ed. 8
ALL CLASSES
Class System
java.lang.Object
java.lang.System
JDK1.0
Field Summary
Fields
Modifier and Type
Method Summary
All Methods
Static Methods
Concrete Methods
Deprecated Methods
Modifier and Type
static void
static String
clearProperty(String key)
Removes the system property indicated by the
specified key.
static Console
console()
Returns the unique Console object associated with
the current Java virtual machine, if any.
static long
currentTimeMillis()
Returns the current time in milliseconds.
static void
exit(int status)
Terminates the currently running Java Virtual
Machine.
static void
gc()
Runs the garbage collector.
getenv(String name)
Gets the value of the specified environment
variable.
static Properties
getProperties()
Determines the current system properties.
static String
getProperty(String key)
Gets the system property indicated by the specified
key.
static String
static SecurityManager
getSecurityManager()
Gets the system security interface.
static int
identityHashCode(Object x)
Returns the same hash code for the given object as
would be returned by the default method
hashCode(), whether or not the given object's class
overrides hashCode().
static Channel
inheritedChannel()
Returns the channel inherited from the entity that
created this Java virtual machine.
static String
lineSeparator()
Returns the system-dependent line separator string.
static void
load(String filename)
Loads the native library specified by the filename
argument.
static void
loadLibrary(String libname)
Loads the native library specified by the libname
argument.
static String
mapLibraryName(String libname)
Maps a library name into a platform-specific string
representing a native library.
static long
nanoTime()
Returns the current value of the running Java
Virtual Machine's high-resolution time source, in
nanoseconds.
static void
runFinalization()
Runs the finalization methods of any objects
pending finalization.
static void
runFinalizersOnExit(boolean value)
Deprecated.
This method is inherently unsafe. It may result in
finalizers being called on live objects while other
threads are concurrently manipulating those
objects, resulting in erratic behavior or deadlock.
static void
setErr(PrintStream err)
Reassigns the "standard" error output stream.
static void
setIn(InputStream in)
Reassigns the "standard" input stream.
static void
setOut(PrintStream out)
Reassigns the "standard" output stream.
static void
setProperties(Properties props)
Sets the system properties to the Properties
argument.
static String
static void
setSecurityManager(SecurityManager s)
Sets the System security.
Field Detail
in
PrintStream.println(), PrintStream.println(boolean),
PrintStream.println(char), PrintStream.println(char[]),
PrintStream.println(double), PrintStream.println(float),
PrintStream.println(int), PrintStream.println(long),
PrintStream.println(java.lang.Object),
PrintStream.println(java.lang.String)
err
Method Detail
setIn
JDK1.1
See Also:
SecurityManager.checkPermission(java.security.Permission),
RuntimePermission
setOut
JDK1.1
See Also:
SecurityManager.checkPermission(java.security.Permission),
RuntimePermission
setErr
JDK1.1
See Also:
SecurityManager.checkPermission(java.security.Permission),
RuntimePermission
console
1.6
inheritedChannel
1.5
setSecurityManager
Parameters:
getSecurityManager(),
SecurityManager.checkPermission(java.security.Permission),
RuntimePermission
getSecurityManager
setSecurityManager(java.lang.SecurityManager)
currentTimeMillis
Date
nanoTime
Returns the current value of the running Java Virtual Machine's high-resolution time
source, in nanoseconds.
This method can only be used to measure elapsed time and is not related to any other
notion of system or wall-clock time. The value returned represents nanoseconds since
some fixed but arbitrary origin time (perhaps in the future, so values may be
negative). The same origin is used by all invocations of this method in an instance of
a Java virtual machine; other virtual machine instances are likely to use a different
origin.
This method provides nanosecond precision, but not necessarily nanosecond
resolution (that is, how frequently the value changes) - no guarantees are made
except that the resolution is at least as good as that of currentTimeMillis().
Differences in successive calls that span greater than approximately 292 years (2 63
nanoseconds) will not correctly compute elapsed time due to numerical overflow.
The values returned by this method become meaningful only when the difference
between two such values, obtained within the same instance of a Java virtual
machine, is computed.
For example, to measure how long some code takes to execute:
long startTime = System.nanoTime();
// ... the code being measured ...
long estimatedTime = System.nanoTime() - startTime;
To compare two nanoTime values
long t0 = System.nanoTime();
...
long t1 = System.nanoTime();
one should use t1 - t0 < 0, not t1 < t0, because of the possibility of numerical
overflow.
Returns:
1.5
arraycopy
int length)
Copies an array from the specified source array, beginning at the specified position,
to the specified position of the destination array. A subsequence of array components
are copied from the source array referenced by src to the destination array
referenced by dest. The number of components copied is equal to the length
argument. The components at positions srcPos through srcPos+length-1 in the
source array are copied into positions destPos through destPos+length-1,
respectively, of the destination array.
If the src and dest arguments refer to the same array object, then the copying is
performed as if the components at positions srcPos through srcPos+length-1 were
first copied to a temporary array with length components and then the contents of
the temporary array were copied into positions destPos through
destPos+length-1 of the destination array.
If dest is null, then a NullPointerException is thrown.
If src is null, then a NullPointerException is thrown and the destination array is
not modified.
Otherwise, if any of the following is true, an ArrayStoreException is thrown and
the destination is not modified:
The src argument refers to an object that is not an array.
The dest argument refers to an object that is not an array.
The src argument and dest argument refer to arrays whose component types
are different primitive types.
The src argument refers to an array with a primitive component type and the
dest argument refers to an array with a reference component type.
The src argument refers to an array with a reference component type and the
dest argument refers to an array with a primitive component type.
Otherwise, if any of the following is true, an IndexOutOfBoundsException is
thrown and the destination is not modified:
The srcPos argument is negative.
The destPos argument is negative.
The length argument is negative.
srcPos+length is greater than src.length, the length of the source array.
destPos+length is greater than dest.length, the length of the destination
array.
Otherwise, if any actual component of the source array from position srcPos through
srcPos+length-1 cannot be converted to the component type of the destination
array by assignment conversion, an ArrayStoreException is thrown. In this case,
let k be the smallest nonnegative integer less than length such that src[srcPos+k]
cannot be converted to the component type of the destination array; when the
exception is thrown, source array components from positions srcPos through
srcPos+k-1 will already have been copied to destination array positions destPos
through destPos+k-1 and no other positions of the destination array will have been
identityHashCode
the hashCode
Since:
JDK1.1
getProperties
of system properties is first created and initialized. This set of system properties
always includes values for the following keys:
Key
java.version
java.vendor
java.vendor.url
java.home
java.vm.version
java.vm.vendor
java.vm.name
java.specification.version
java.specification.vendor
java.specification.name
java.class.version
java.class.path
java.library.path
java.io.tmpdir
java.compiler
java.ext.dirs
os.name
os.arch
os.version
file.separator
path.separator
line.separator
user.name
user.home
user.dir
Multiple paths in a system property value are separated by the path separator
character of the platform.
Note that even if the security manager does not permit the getProperties
operation, it may choose to permit the getProperty(String) operation.
Returns:
setProperties(java.util.Properties), SecurityException,
SecurityManager.checkPropertiesAccess(), Properties
lineSeparator
1.7
setProperties
SecurityManager.checkPropertiesAccess()
getProperty
getProperty
setProperty(java.lang.String, java.lang.String),
SecurityManager.checkPropertyAccess(java.lang.String),
getProperties()
setProperty
1.2
See Also:
getProperty(java.lang.String), getProperty(java.lang.String),
getProperty(java.lang.String, java.lang.String), PropertyPermission,
SecurityManager.checkPermission(java.security.Permission)
clearProperty
1.5
See Also:
getProperty(java.lang.String), setProperty(java.lang.String,
java.lang.String), Properties, SecurityException,
SecurityManager.checkPropertiesAccess()
getenv
getenv(), ProcessBuilder.environment()
getenv
1.5
See Also:
getenv(String), ProcessBuilder.environment()
exit
Runtime.exit(int)
gc
Runtime.gc()
runFinalization
Runtime.runFinalization()
runFinalizersOnExit
@Deprecated
public static void runFinalizersOnExit(boolean value)
Deprecated. This method is inherently unsafe. It may result in finalizers being
called on live objects while other threads are concurrently manipulating those
objects, resulting in erratic behavior or deadlock.
Enable or disable finalization on exit; doing so specifies that the finalizers of all
objects that have finalizers that have not yet been automatically invoked are to be run
before the Java runtime exits. By default, finalization on exit is disabled.
If there is a security manager, its checkExit method is first called with 0 as its
argument to ensure the exit is allowed. This could result in a SecurityException.
Parameters:
JDK1.1
See Also:
load
Runtime.load(java.lang.String),
SecurityManager.checkLink(java.lang.String)
loadLibrary
Runtime.getRuntime().loadLibrary(name)
Parameters:
Runtime.loadLibrary(java.lang.String),
SecurityManager.checkLink(java.lang.String)
mapLibraryName
1.2
See Also:
loadLibrary(java.lang.String),
ClassLoader.findLibrary(java.lang.String)
OVERVIEW
PACKAGE
CLASS
USE
TREE
FRAMES
DEPRECATED
NO FRAMES
INDEX HELP
Java Platform
Standard Ed. 8
ALL CLASSES
contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms,
workarounds, and working code examples.
Copyright 1993, 2015, Oracle and/or its affiliates. All rights reserved.