📄 runtime.html
字号:
<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> - true to enable finalization on exit, false to disable<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>exit(int)</CODE></A>, <A HREF="../../java/lang/Runtime.html#gc()"><CODE>gc()</CODE></A>, <A HREF="../../java/lang/SecurityManager.html#checkExit(int)"><CODE>SecurityManager.checkExit(int)</CODE></A></DL></DD></DL><HR><A NAME="exec(java.lang.String)"><!-- --></A><H3>exec</H3><PRE>public <A HREF="../../java/lang/Process.html">Process</A> <B>exec</B>(<A HREF="../../java/lang/String.html">String</A> command) throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>Executes the specified string command in a separate process. <p> The <code>command</code> argument is parsed into tokens and then executed as a command in a separate process. The token parsing is done by a <A HREF="../../java/util/StringTokenizer.html"><CODE>StringTokenizer</CODE></A> created by the call: <blockquote><pre> new StringTokenizer(command) </pre></blockquote> with no further modifications of the character categories. This method has exactly the same effect as <code>exec(command, null)</code>.<DD><DL><DT><B>Parameters:</B><DD><CODE>command</CODE> - a specified system command.<DT><B>Returns:</B><DD>a <code>Process</code> object for managing the subprocess.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its <code>checkExec</code> method doesn't allow creation of a subprocess.<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs<DT><B>See Also: </B><DD><A HREF="../../java/lang/Runtime.html#exec(java.lang.String, java.lang.String[])"><CODE>exec(java.lang.String, java.lang.String[])</CODE></A>, <A HREF="../../java/lang/SecurityManager.html#checkExec(java.lang.String)"><CODE>SecurityManager.checkExec(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="exec(java.lang.String, java.lang.String[])"><!-- --></A><H3>exec</H3><PRE>public <A HREF="../../java/lang/Process.html">Process</A> <B>exec</B>(<A HREF="../../java/lang/String.html">String</A> cmd, <A HREF="../../java/lang/String.html">String</A>[] envp) throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>Executes the specified string command in a separate process with the specified environment. <p> This method breaks the <code>command</code> string into tokens and creates a new array <code>cmdarray</code> containing the tokens in the order that they were produced by the string tokenizer; it then performs the call <code>exec(cmdarray, envp)</code>. The token parsing is done by a <A HREF="../../java/util/StringTokenizer.html"><CODE>StringTokenizer</CODE></A> created by the call: <blockquote><pre> new StringTokenizer(command) </pre></blockquote> with no further modification of the character categories. <p> The environment variable settings are specified by <tt>envp</tt>. If <tt>envp</tt> is <tt>null</tt>, the subprocess inherits the environment settings of the current process.<DD><DL><DT><B>Parameters:</B><DD><CODE>cmd</CODE> - a specified system command.<DD><CODE>envp</CODE> - array of strings, each element of which has environment variable settings in format <i>name</i>=<i>value</i>.<DT><B>Returns:</B><DD>a <code>Process</code> object for managing the subprocess.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its <code>checkExec</code> method doesn't allow creation of a subprocess.<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs<DT><B>See Also: </B><DD><A HREF="../../java/lang/Runtime.html#exec(java.lang.String[])"><CODE>exec(java.lang.String[])</CODE></A>, <A HREF="../../java/lang/Runtime.html#exec(java.lang.String[], java.lang.String[])"><CODE>exec(java.lang.String[], java.lang.String[])</CODE></A>, <A HREF="../../java/lang/SecurityManager.html#checkExec(java.lang.String)"><CODE>SecurityManager.checkExec(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="exec(java.lang.String, java.lang.String[], java.io.File)"><!-- --></A><H3>exec</H3><PRE>public <A HREF="../../java/lang/Process.html">Process</A> <B>exec</B>(<A HREF="../../java/lang/String.html">String</A> command, <A HREF="../../java/lang/String.html">String</A>[] envp, <A HREF="../../java/io/File.html">File</A> dir) throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>Executes the specified string command in a separate process with the specified environment and working directory. <p> This method breaks the <code>command</code> string into tokens and creates a new array <code>cmdarray</code> containing the tokens in the order that they were produced by the string tokenizer; it then performs the call <code>exec(cmdarray, envp)</code>. The token parsing is done by a <A HREF="../../java/util/StringTokenizer.html"><CODE>StringTokenizer</CODE></A> created by the call: <blockquote><pre> new StringTokenizer(command) </pre></blockquote> with no further modification of the character categories. <p> The environment variable settings are specified by <tt>envp</tt>. If <tt>envp</tt> is <tt>null</tt>, the subprocess inherits the environment settings of the current process. <p> The working directory of the new subprocess is specified by <tt>dir</tt>. If <tt>dir</tt> is <tt>null</tt>, the subprocess inherits the current working directory of the current process.<DD><DL><DT><B>Parameters:</B><DD><CODE>command</CODE> - a specified system command.<DD><CODE>envp</CODE> - array of strings, each element of which has environment variable settings in format <i>name</i>=<i>value</i>.<DD><CODE>dir</CODE> - the working directory of the subprocess, or <tt>null</tt> if the subprocess should inherit the working directory of the current process.<DT><B>Returns:</B><DD>a <code>Process</code> object for managing the subprocess.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its <code>checkExec</code> method doesn't allow creation of a subprocess.<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs<DT><B>See Also: </B><DD><A HREF="../../java/lang/Runtime.html#exec(java.lang.String[], java.lang.String[], java.io.File)"><CODE>exec(java.lang.String[], java.lang.String[], File)</CODE></A>, <A HREF="../../java/lang/SecurityManager.html#checkExec(java.lang.String)"><CODE>SecurityManager.checkExec(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="exec(java.lang.String[])"><!-- --></A><H3>exec</H3><PRE>public <A HREF="../../java/lang/Process.html">Process</A> <B>exec</B>(<A HREF="../../java/lang/String.html">String</A>[] cmdarray) throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>Executes the specified command and arguments in a separate process. <p> The command specified by the tokens in <code>cmdarray</code> is executed as a command in a separate process. This has exactly the same effect as <code>exec(cmdarray, null)</code>. <p> If there is a security manager, its <code>checkExec</code> method is called with the first component of the array <code>cmdarray</code> as its argument. This may result in a security exception.<DD><DL><DT><B>Parameters:</B><DD><CODE>cmdarray</CODE> - array containing the command to call and its arguments.<DT><B>Returns:</B><DD>a <code>Process</code> object for managing the subprocess.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its <code>checkExec</code> method doesn't allow creation of a subprocess.<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs<DT><B>See Also: </B><DD><A HREF="../../java/lang/Runtime.html#exec(java.lang.String[], java.lang.String[])"><CODE>exec(java.lang.String[], java.lang.String[])</CODE></A>, <A HREF="../../java/lang/SecurityManager.html#checkExec(java.lang.String)"><CODE>SecurityManager.checkExec(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="exec(java.lang.String[], java.lang.String[])"><!-- --></A><H3>exec</H3><PRE>public <A HREF="../../java/lang/Process.html">Process</A> <B>exec</B>(<A HREF="../../java/lang/String.html">String</A>[] cmdarray, <A HREF="../../java/lang/String.html">String</A>[] envp) throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>Executes the specified command and arguments in a separate process with the specified environment. <p> Given an array of strings <code>cmdarray</code>, representing the tokens of a command line, and an array of strings <code>envp</code>, representing "environment" variable settings, this method creates a new process in which to execute the specified command. <p> If <tt>envp</tt> is <tt>null</tt>, the subprocess inherits the environment settings of the current process.<DD><DL><DT><B>Parameters:</B><DD><CODE>cmdarray</CODE> - array containing the command to call and its arguments.<DD><CODE>envp</CODE> - array of strings, each element of which has environment variable settings in format <i>name</i>=<i>value</i>.<DT><B>Returns:</B><DD>a <code>Process</code> object for managing the subprocess.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its <code>checkExec</code> method doesn't allow creation of a subprocess.<DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>cmdarray</code> is <code>null</code>.<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if <code>cmdarray</code> is an empty array (has length <code>0</code>).<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs<DT><B>See Also: </B><DD><A HREF="../../java/lang/Process.html"><CODE>Process</CODE></A>, <A HREF="../../java/lang/SecurityException.html"><CODE>SecurityException</CODE></A>, <A HREF="../../java/lang/SecurityManager.html#checkExec(java.lang.String)"><CODE>SecurityManager.checkExec(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="exec(java.lang.String[], java.lang.String[], java.io.File)"><!-- --></A><H3>exec</H3><PRE>public <A HREF="../../java/lang/Process.html">Process</A> <B>exec</B>(<A HREF="../../java/lang/String.html">String</A>[] cmdarray, <A HREF="../../java/lang/String.html">String</A>[] envp, <A HREF="../../java/io/File.html">File</A> dir) throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>Executes the specified command and arguments in a separate process with the specified environment and working directory. <p> If there is a security manager, its <code>checkExec</code> method is called with the first component of the array <code>cmdarray</code> as its argument. This may result in a security exception. <p> Given an array of strings <code>cmdarray</code>, representing the tokens of a command line, and an array of strings <code>envp</code>, representing "environment" variable settings, this method creates a new process in which to execute the specified command. <p> If <tt>envp</tt> is <tt>null</tt>, the subprocess inherits the environment settings of the current process. <p> The working directory of the new subprocess is specified by <tt>dir</tt>. If <tt>dir</tt> is <tt>null</tt>, the subprocess inherits the current working directory of the current process.<DD><DL><DT><B>Parameters:</B><DD><CODE>cmdarray</CODE> - array containing the command to call and its arguments.<DD><CODE>envp</CODE> - array of strings, each element of which has environment variable settings in format <i>name</i>=<i>value</i>.<DD><CODE>dir</CODE> - the working directory of the subprocess, or <tt>null</tt> if the subprocess should inherit the working directory of the current process.<DT><B>Returns:</B><DD>a <code>Process</code> object for managing the subprocess.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its <code>checkExec</code> method doesn't allow creation of a subprocess.<DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>cmdarray</code> is <code>null</code>.<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if <code>cmdarray</code> is an empty array (has length <code>0</code>).<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Process.html"><CODE>Process</CODE></A>, <A HREF="../../java/lang/SecurityException.html"><CODE>SecurityException</CODE></A>, <A HREF="../../java/lang/SecurityManager.html#checkExec(java.lang.String)"><CODE>SecurityManager.checkExec(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="freeMemory()"><!-- --></A><H3>freeMemory</H3><PRE>public long <B>freeMemory</B>()</PRE><DL><DD>Returns the amount of free memory in the system. Calling the <code>gc</code> method may result in increasing the value returned by <code>freeMemory.</code><DD><DL><DT><B>Returns:</B><DD>an approximation to the total amount of memory currently available for future allocated objects, measured in bytes.</DL></DD></DL><HR><A NAME="totalMemory()"><!-- --></A><H3>totalMemory</H3><PRE>public long <B>totalMemory</B>()</PRE><DL><DD>Returns the total amount of memory in the Java Virtual Machine. The value returned by this method may vary over time, depending on the host environment. <p> Note that the amount of memory required to hold an object of any given type may be implementation-dependent.<DD><DL><DT><B>Returns:</B><DD>the total amount of memory currently available for current and future objects, measured in bytes.</DL></DD></DL><HR><A NAME="gc()"><!-- --></A><H3>gc</H3><PRE>public void <B>gc</B>()</PRE><DL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -