public final class System extends Object
Modifier and Type | Field and Description |
---|---|
static PrintStream |
err
Default error output stream
|
static InputStream |
in
Default input stream
|
static PrintStream |
out
Default output stream
|
Modifier and Type | Method and Description |
---|---|
static void |
arraycopy(Object array1,
int start1,
Object array2,
int start2,
int length)
Copies the contents of
array1 starting at offset start1
into array2 starting at offset start2 for
length elements. |
static String |
clearProperty(String prop)
Removes the property.
|
static Console |
console()
Return the Console or null.
|
static long |
currentTimeMillis()
Answers the current time expressed as milliseconds since
the time 00:00:00 UTC on January 1, 1970.
|
static void |
exit(int code)
Causes the virtual machine to stop running, and the
program to exit.
|
static void |
gc()
Indicate to the virtual machine that it would be a
good time to collect available memory.
|
static Map<String,String> |
getenv()
Returns all of the system environment variables in an unmodifiable Map.
|
static String |
getenv(String var)
Returns an environment variable.
|
static Properties |
getProperties()
Answers the system properties.
|
static String |
getProperty(String prop)
Answers the value of a particular system property.
|
static String |
getProperty(String prop,
String defaultValue)
Answers the value of a particular system property.
|
static SecurityManager |
getSecurityManager()
Answers the active security manager.
|
static int |
identityHashCode(Object anObject)
Answers an integer hash code for the parameter.
|
static Channel |
inheritedChannel()
Return the channel inherited by the invocation of the running vm.
|
static String |
lineSeparator()
Return platform specific line separator character(s).
|
static void |
load(String pathName)
Loads the specified file as a dynamic library.
|
static void |
loadLibrary(String libName)
Loads and links the library specified by the argument.
|
static String |
mapLibraryName(String userLibName)
Answers the platform-specific filename for the shared
library named by the argument.
|
static long |
nanoTime()
Returns the current tick count in nanoseconds.
|
static void |
runFinalization()
Provides a hint to the virtual machine that it would
be useful to attempt to perform any outstanding
object finalizations.
|
static void |
runFinalizersOnExit(boolean flag)
Deprecated.
This method is unsafe.
|
static void |
setErr(PrintStream newErr)
Sets the value of the static slot "err" in the receiver
to the passed in argument.
|
static void |
setIn(InputStream newIn)
Sets the value of the static slot "in" in the receiver
to the passed in argument.
|
static void |
setOut(PrintStream newOut)
Sets the value of the static slot "out" in the receiver
to the passed in argument.
|
static void |
setProperties(Properties p)
Sets the system properties.
|
static String |
setProperty(String prop,
String value)
Sets the value of a particular system property.
|
static void |
setSecurityManager(SecurityManager s)
Sets the active security manager.
|
public static final InputStream in
public static final PrintStream out
public static final PrintStream err
public static void setIn(InputStream newIn)
newIn
- the new value for in.public static void setOut(PrintStream newOut)
newOut
- the new value for out.public static void setErr(PrintStream newErr)
newErr
- the new value for err.public static void arraycopy(Object array1, int start1, Object array2, int start2, int length)
array1
starting at offset start1
into array2
starting at offset start2
for
length
elements.array1
- the array to copy out ofstart1
- the starting index in array1array2
- the array to copy intostart2
- the starting index in array2length
- the number of elements in the array to copypublic static long currentTimeMillis()
public static void exit(int code)
code
- the return code.SecurityException
- if the running thread is not allowed to cause the vm to exit.SecurityManager.checkExit(int)
public static void gc()
public static String getenv(String var)
var
- the name of the environment variablepublic static Properties getProperties()
getProperty()
and getProperties()
.
Security managers should restrict access to this API if possible.
public static String getProperty(String prop)
The properties currently provided by the virtual machine are:
file.separator java.class.path java.class.version java.home java.vendor java.vendor.url java.version line.separator os.arch os.name os.version path.separator user.dir user.home user.name user.timezone
prop
- the system property to look uppublic static String getProperty(String prop, String defaultValue)
prop
- the system property to look updefaultValue
- return value if system property is not foundpublic static String setProperty(String prop, String value)
prop
- the system property to changevalue
- the value to associate with proppublic static SecurityManager getSecurityManager()
public static int identityHashCode(Object anObject)
anObject
- the objectObject.hashCode()
public static void load(String pathName)
pathName
- the path of the file to be loadedpublic static void loadLibrary(String libName)
libName
- the name of the library to loadUnsatisfiedLinkError
- if the library could not be loadedSecurityException
- if the library was not allowed to be loadedpublic static void runFinalization()
@Deprecated public static void runFinalizersOnExit(boolean flag)
UnsupportedOperationException
.public static void setProperties(Properties p)
getProperty()
and getProperties()
.
Security managers should restrict access to this API if possible.
p
- the properties to setpublic static void setSecurityManager(SecurityManager s)
s
- the new security managerSecurityException
- if the security manager has already been set and its checkPermission method doesn't allow it to be replaced.public static String mapLibraryName(String userLibName)
userLibName
- the name of the library to look up.public static Channel inheritedChannel() throws IOException
IOException
- if an IO error occurs getting the inherited channelpublic static long nanoTime()
public static String clearProperty(String prop)
prop
- the name of the property to removepublic static Map<String,String> getenv()
public static Console console()
public static String lineSeparator()
Eclipse OpenJ9 website.
To raise a bug report or suggest an improvement create an Eclipse OpenJ9 issue.
Copyright © 1993, 2023 IBM Corp. and others.