📄 system.html
字号:
<A NAME="setProperty(java.lang.String, java.lang.String)"><!-- --></A><H3>setProperty</H3><PRE>public static <A HREF="../../java/lang/String.html">String</A> <B>setProperty</B>(<A HREF="../../java/lang/String.html">String</A> key, <A HREF="../../java/lang/String.html">String</A> value)</PRE><DL><DD>Sets the system property indicated by the specified key. <p> First, if a security manager exists, its <code>SecurityManager.checkPermission</code> method is called with a <code>PropertyPermission(key, "write")</code> permission. This may result in a SecurityException being thrown. If no exception is thrown, the specified property is set to the given value. <p><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - the name of the system property.<DD><CODE>value</CODE> - the value of the system property.<DT><B>Returns:</B><DD>the previous value of the system property, or <code>null</code> if it did not have one.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its <code>checkPermission</code> method doesn't allow setting of the specified property.<DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>key</code> is <code>null</code>.<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <code>key</code> is empty.<DT><B>Since: </B><DD>1.2</DD><DT><B>See Also: </B><DD><A HREF="../../java/lang/System.html#getProperty(java.lang.String)"><CODE>getProperty(java.lang.String)</CODE></A>, <A HREF="../../java/lang/System.html#getProperty(java.lang.String)"><CODE>getProperty(java.lang.String)</CODE></A>, <A HREF="../../java/lang/System.html#getProperty(java.lang.String, java.lang.String)"><CODE>getProperty(java.lang.String, java.lang.String)</CODE></A>, <A HREF="../../java/util/PropertyPermission.html"><CODE>PropertyPermission</CODE></A>, <A HREF="../../java/lang/SecurityManager.html#checkPermission(java.security.Permission)"><CODE>SecurityManager.checkPermission(java.security.Permission)</CODE></A></DL></DD></DL><HR><A NAME="getenv(java.lang.String)"><!-- --></A><H3>getenv</H3><PRE>public static <A HREF="../../java/lang/String.html">String</A> <B>getenv</B>(<A HREF="../../java/lang/String.html">String</A> name)</PRE><DL><DD><B>Deprecated.</B> <I>The preferred way to extract system-dependent information is the system properties of the <code>java.lang.System.getProperty</code> methods and the corresponding <code>get</code><em>TypeName</em> methods of the <code>Boolean</code>, <code>Integer</code>, and <code>Long</code> primitive types. For example: <blockquote><pre> String classPath = System.getProperty("java.class.path","."); <br> if (Boolean.getBoolean("myapp.exper.mode")) enableExpertCommands(); </pre></blockquote></I><P><DD>Gets an environment variable. An environment variable is a system-dependent external variable that has a string value.<DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - of the environment variable<DT><B>Returns:</B><DD>the value of the variable, or <code>null</code> if the variable is not defined.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Boolean.html#getBoolean(java.lang.String)"><CODE>Boolean.getBoolean(java.lang.String)</CODE></A>, <A HREF="../../java/lang/Integer.html#getInteger(java.lang.String)"><CODE>Integer.getInteger(java.lang.String)</CODE></A>, <A HREF="../../java/lang/Integer.html#getInteger(java.lang.String, int)"><CODE>Integer.getInteger(java.lang.String, int)</CODE></A>, <A HREF="../../java/lang/Integer.html#getInteger(java.lang.String, java.lang.Integer)"><CODE>Integer.getInteger(java.lang.String, java.lang.Integer)</CODE></A>, <A HREF="../../java/lang/Long.html#getLong(java.lang.String)"><CODE>Long.getLong(java.lang.String)</CODE></A>, <A HREF="../../java/lang/Long.html#getLong(java.lang.String, long)"><CODE>Long.getLong(java.lang.String, long)</CODE></A>, <A HREF="../../java/lang/Long.html#getLong(java.lang.String, java.lang.Long)"><CODE>Long.getLong(java.lang.String, java.lang.Long)</CODE></A>, <A HREF="../../java/lang/System.html#getProperties()"><CODE>getProperties()</CODE></A>, <A HREF="../../java/lang/System.html#getProperty(java.lang.String)"><CODE>getProperty(java.lang.String)</CODE></A>, <A HREF="../../java/lang/System.html#getProperty(java.lang.String, java.lang.String)"><CODE>getProperty(java.lang.String, java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="exit(int)"><!-- --></A><H3>exit</H3><PRE>public static void <B>exit</B>(int status)</PRE><DL><DD>Terminates the currently running Java Virtual Machine. The argument serves as a status code; by convention, a nonzero status code indicates abnormal termination. <p> This method calls the <code>exit</code> method in class <code>Runtime</code>. This method never returns normally. <p> The call <code>System.exit(n)</code> is effectively equivalent to the call: <blockquote><pre> Runtime.getRuntime().exit(n) </pre></blockquote><DD><DL><DT><B>Parameters:</B><DD><CODE>status</CODE> - exit status.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its <code>checkExit</code> method doesn't allow exit with the specified status.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Runtime.html#exit(int)"><CODE>Runtime.exit(int)</CODE></A></DL></DD></DL><HR><A NAME="gc()"><!-- --></A><H3>gc</H3><PRE>public static void <B>gc</B>()</PRE><DL><DD>Runs the garbage collector. <p> Calling the <code>gc</code> method suggests that the Java Virtual Machine expend effort toward recycling unused objects in order to make the memory they currently occupy available for quick reuse. When control returns from the method call, the Java Virtual Machine has made a best effort to reclaim space from all discarded objects. <p> The call <code>System.gc()</code> is effectively equivalent to the call: <blockquote><pre> Runtime.getRuntime().gc() </pre></blockquote><DD><DL><DT><B>See Also: </B><DD><A HREF="../../java/lang/Runtime.html#gc()"><CODE>Runtime.gc()</CODE></A></DL></DD></DL><HR><A NAME="runFinalization()"><!-- --></A><H3>runFinalization</H3><PRE>public static void <B>runFinalization</B>()</PRE><DL><DD>Runs the finalization methods of any objects pending finalization. <p> Calling this method suggests that the Java Virtual Machine expend effort toward running the <code>finalize</code> methods of objects that have been found to be discarded but whose <code>finalize</code> methods have not yet been run. When control returns from the method call, the Java Virtual Machine has made a best effort to complete all outstanding finalizations. <p> The call <code>System.runFinalization()</code> is effectively equivalent to the call: <blockquote><pre> Runtime.getRuntime().runFinalization() </pre></blockquote><DD><DL><DT><B>See Also: </B><DD><A HREF="../../java/lang/Runtime.html#runFinalization()"><CODE>Runtime.runFinalization()</CODE></A></DL></DD></DL><HR><A NAME="runFinalizersOnExit(boolean)"><!-- --></A><H3>runFinalizersOnExit</H3><PRE>public static void <B>runFinalizersOnExit</B>(boolean value)</PRE><DL><DD><B>Deprecated.</B> <I>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.</I><P><DD>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. <p>If there is a security manager, its <code>checkExit</code> method is first called with 0 as its argument to ensure the exit is allowed. This could result in a SecurityException.<DD><DL><DT><B>Parameters:</B><DD><CODE>value</CODE> - indicating enabling or disabling of finalization<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its <code>checkExit</code> method doesn't allow the exit.<DT><B>Since: </B><DD>JDK1.1</DD><DT><B>See Also: </B><DD><A HREF="../../java/lang/Runtime.html#exit(int)"><CODE>Runtime.exit(int)</CODE></A>, <A HREF="../../java/lang/Runtime.html#gc()"><CODE>Runtime.gc()</CODE></A>, <A HREF="../../java/lang/SecurityManager.html#checkExit(int)"><CODE>SecurityManager.checkExit(int)</CODE></A></DL></DD></DL><HR><A NAME="load(java.lang.String)"><!-- --></A><H3>load</H3><PRE>public static void <B>load</B>(<A HREF="../../java/lang/String.html">String</A> filename)</PRE><DL><DD>Loads a code file with the specified filename from the local file system as a dynamic library. The filename argument must be a complete pathname. <p> The call <code>System.load(name)</code> is effectively equivalent to the call: <blockquote><pre> Runtime.getRuntime().load(name) </pre></blockquote><DD><DL><DT><B>Parameters:</B><DD><CODE>filename</CODE> - the file to load.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its <code>checkLink</code> method doesn't allow loading of the specified dynamic library<DD><CODE><A HREF="../../java/lang/UnsatisfiedLinkError.html">UnsatisfiedLinkError</A></CODE> - if the file does not exist.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Runtime.html#load(java.lang.String)"><CODE>Runtime.load(java.lang.String)</CODE></A>, <A HREF="../../java/lang/SecurityManager.html#checkLink(java.lang.String)"><CODE>SecurityManager.checkLink(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="loadLibrary(java.lang.String)"><!-- --></A><H3>loadLibrary</H3><PRE>public static void <B>loadLibrary</B>(<A HREF="../../java/lang/String.html">String</A> libname)</PRE><DL><DD>Loads the system library specified by the <code>libname</code> argument. The manner in which a library name is mapped to the actual system library is system dependent. <p> The call <code>System.loadLibrary(name)</code> is effectively equivalent to the call <blockquote><pre> Runtime.getRuntime().loadLibrary(name) </pre></blockquote><DD><DL><DT><B>Parameters:</B><DD><CODE>libname</CODE> - the name of the library.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its <code>checkLink</code> method doesn't allow loading of the specified dynamic library<DD><CODE><A HREF="../../java/lang/UnsatisfiedLinkError.html">UnsatisfiedLinkError</A></CODE> - if the library does not exist.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Runtime.html#loadLibrary(java.lang.String)"><CODE>Runtime.loadLibrary(java.lang.String)</CODE></A>, <A HREF="../../java/lang/SecurityManager.html#checkLink(java.lang.String)"><CODE>SecurityManager.checkLink(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="mapLibraryName(java.lang.String)"><!-- --></A><H3>mapLibraryName</H3><PRE>public static <A HREF="../../java/lang/String.html">String</A> <B>mapLibraryName</B>(<A HREF="../../java/lang/String.html">String</A> libname)</PRE><DL><DD>Maps a library name into a platform-specific string representing a native library.<DD><DL><DT><B>Parameters:</B><DD><CODE>libname</CODE> - the name of the library.<DT><B>Returns:</B><DD>a platform-dependent native library name.<DT><B>Since: </B><DD>1.2</DD><DT><B>See Also: </B><DD><A HREF="../../java/lang/System.html#loadLibrary(java.lang.String)"><CODE>loadLibrary(java.lang.String)</CODE></A>, <A HREF="../../java/lang/ClassLoader.html#findLibrary(java.lang.String)"><CODE>ClassLoader.findLibrary(java.lang.String)</CODE></A></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/System.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../java/lang/StringBuffer.html"><B>PREV CLASS</B></A> <A HREF="../../java/lang/Thread.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="System.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -