欢迎来到虫虫下载站 | 资源下载 资源专辑 关于我们
虫虫下载站

system.java

Mac OS X 10.4.9 for x86 Source Code gcc 实现源代码
JAVA
第 1 页 / 共 2 页
字号:
   * @return the VM-dependent hash code for this Object   * @since 1.1   */  public static native int identityHashCode(Object o);  /**   * Get all the system properties at once. A security check may be performed,   * <code>checkPropertiesAccess</code>. Note that a security manager may   * allow getting a single property, but not the entire group.   *   * <p>The required properties include:   * <dl>   * <dt>java.version</dt>         <dd>Java version number</dd>   * <dt>java.vendor</dt>          <dd>Java vendor specific string</dd>   * <dt>java.vendor.url</dt>      <dd>Java vendor URL</dd>   * <dt>java.home</dt>            <dd>Java installation directory</dd>   * <dt>java.vm.specification.version</dt> <dd>VM Spec version</dd>   * <dt>java.vm.specification.vendor</dt>  <dd>VM Spec vendor</dd>   * <dt>java.vm.specification.name</dt>    <dd>VM Spec name</dd>   * <dt>java.vm.version</dt>      <dd>VM implementation version</dd>   * <dt>java.vm.vendor</dt>       <dd>VM implementation vendor</dd>   * <dt>java.vm.name</dt>         <dd>VM implementation name</dd>   * <dt>java.specification.version</dt>    <dd>Java Runtime Environment version</dd>   * <dt>java.specification.vendor</dt>     <dd>Java Runtime Environment vendor</dd>   * <dt>java.specification.name</dt>       <dd>Java Runtime Environment name</dd>   * <dt>java.class.version</dt>   <dd>Java class version number</dd>   * <dt>java.class.path</dt>      <dd>Java classpath</dd>   * <dt>java.library.path</dt>    <dd>Path for finding Java libraries</dd>   * <dt>java.io.tmpdir</dt>       <dd>Default temp file path</dd>   * <dt>java.compiler</dt>        <dd>Name of JIT to use</dd>   * <dt>java.ext.dirs</dt>        <dd>Java extension path</dd>   * <dt>os.name</dt>              <dd>Operating System Name</dd>   * <dt>os.arch</dt>              <dd>Operating System Architecture</dd>   * <dt>os.version</dt>           <dd>Operating System Version</dd>   * <dt>file.separator</dt>       <dd>File separator ("/" on Unix)</dd>   * <dt>path.separator</dt>       <dd>Path separator (":" on Unix)</dd>   * <dt>line.separator</dt>       <dd>Line separator ("\n" on Unix)</dd>   * <dt>user.name</dt>            <dd>User account name</dd>   * <dt>user.home</dt>            <dd>User home directory</dd>   * <dt>user.dir</dt>             <dd>User's current working directory</dd>   * </dl>   *   * In addition, gnu defines several other properties, where ? stands for   * each character in '0' through '9':   * <dl>   * <dt>gnu.classpath.home</dt>         <dd>Path to the classpath libraries.</dd>   * <dt>gnu.classpath.version</dt>      <dd>Version of the classpath libraries.</dd>   * <dt>gnu.classpath.vm.shortname</dt> <dd>Succinct version of the VM name;   *     used for finding property files in file system</dd>   * <dt>gnu.classpath.home.url</dt>     <dd> Base URL; used for finding   *     property files in file system</dd>   * <dt>gnu.cpu.endian</dt>             <dd>big or little</dd>   * <dt>gnu.java.io.encoding_scheme_alias.ISO-8859-?</dt>   <dd>8859_?</dd>   * <dt>gnu.java.io.encoding_scheme_alias.iso-8859-?</dt>   <dd>8859_?</dd>   * <dt>gnu.java.io.encoding_scheme_alias.iso8859_?</dt>    <dd>8859_?</dd>   * <dt>gnu.java.io.encoding_scheme_alias.iso-latin-_?</dt> <dd>8859_?</dd>   * <dt>gnu.java.io.encoding_scheme_alias.latin?</dt>       <dd>8859_?</dd>   * <dt>gnu.java.io.encoding_scheme_alias.UTF-8</dt>        <dd>UTF8</dd>   * <dt>gnu.java.io.encoding_scheme_alias.utf-8</dt>        <dd>UTF8</dd>   * </dl>   *   * @return the system properties, will never be null   * @throws SecurityException if permission is denied   */  public static Properties getProperties()  {    SecurityManager sm = Runtime.securityManager; // Be thread-safe.    if (sm != null)      sm.checkPropertiesAccess();    return properties;  }  /**   * Set all the system properties at once. A security check may be performed,   * <code>checkPropertiesAccess</code>. Note that a security manager may   * allow setting a single property, but not the entire group. An argument   * of null resets the properties to the startup default.   *   * @param properties the new set of system properties   * @throws SecurityException if permission is denied   */  public static void setProperties(Properties properties)  {    SecurityManager sm = Runtime.securityManager; // Be thread-safe.    if (sm != null)      sm.checkPropertiesAccess();    if (properties == null)      {	// Note that we use clone here and not new.  Some programs	// assume that the system properties do not have a parent.	properties = (Properties) Runtime.defaultProperties.clone();      }    System.properties = properties;  }  /**   * Get a single system property by name. A security check may be performed,   * <code>checkPropertyAccess(key)</code>.   *   * @param key the name of the system property to get   * @return the property, or null if not found   * @throws SecurityException if permission is denied   * @throws NullPointerException if key is null   * @throws IllegalArgumentException if key is ""   */  public static String getProperty(String key)  {    SecurityManager sm = Runtime.securityManager; // Be thread-safe.    if (sm != null)      sm.checkPropertyAccess(key);    else if (key.length() == 0)      throw new IllegalArgumentException("key can't be empty");    return properties.getProperty(key);  }  /**   * Get a single system property by name. A security check may be performed,   * <code>checkPropertyAccess(key)</code>.   *   * @param key the name of the system property to get   * @param def the default   * @return the property, or def if not found   * @throws SecurityException if permission is denied   * @throws NullPointerException if key is null   * @throws IllegalArgumentException if key is ""   */  public static String getProperty(String key, String def)  {    SecurityManager sm = Runtime.securityManager; // Be thread-safe.    if (sm != null)      sm.checkPropertyAccess(key);    return properties.getProperty(key, def);  }  /**   * Set a single system property by name. A security check may be performed,   * <code>checkPropertyAccess(key, "write")</code>.   *   * @param key the name of the system property to set   * @param value the new value   * @return the previous value, or null   * @throws SecurityException if permission is denied   * @throws NullPointerException if key is null   * @throws IllegalArgumentException if key is ""   * @since 1.2   */  public static String setProperty(String key, String value)  {    SecurityManager sm = Runtime.securityManager; // Be thread-safe.    if (sm != null)      sm.checkPermission(new PropertyPermission(key, "write"));    return (String) properties.setProperty(key, value);  }  /**   * Gets the value of an environment variable.   *   * @param name the name of the environment variable   * @return the string value of the variable   * @throws NullPointerException   * @throws SecurityException if permission is denied   * @since 1.5   */  public static String getenv(String name)  {    if (name == null)      throw new NullPointerException();    SecurityManager sm = Runtime.securityManager; // Be thread-safe.    if (sm != null)      sm.checkPermission(new RuntimePermission("getenv."+name));    return getenv0(name);  }  /**   * Terminate the Virtual Machine. This just calls   * <code>Runtime.getRuntime().exit(status)</code>, and never returns.   * Obviously, a security check is in order, <code>checkExit</code>.   *   * @param status the exit status; by convention non-zero is abnormal   * @throws SecurityException if permission is denied   * @see Runtime#exit(int)   */  public static void exit(int status)  {    Runtime.getRuntime().exit(status);  }  /**   * Calls the garbage collector. This is only a hint, and it is up to the   * implementation what this hint suggests, but it usually causes a   * best-effort attempt to reclaim unused memory from discarded objects.   * This calls <code>Runtime.getRuntime().gc()</code>.   *   * @see Runtime#gc()   */  public static void gc()  {    Runtime.getRuntime().gc();  }  /**   * Runs object finalization on pending objects. This is only a hint, and   * it is up to the implementation what this hint suggests, but it usually   * causes a best-effort attempt to run finalizers on all objects ready   * to be reclaimed. This calls   * <code>Runtime.getRuntime().runFinalization()</code>.   *   * @see Runtime#runFinalization()   */  public static void runFinalization()  {    Runtime.getRuntime().runFinalization();  }  /**   * Tell the Runtime whether to run finalization before exiting the   * JVM.  This is inherently unsafe in multi-threaded applications,   * since it can force initialization on objects which are still in use   * by live threads, leading to deadlock; therefore this is disabled by   * default. There may be a security check, <code>checkExit(0)</code>. This   * calls <code>Runtime.getRuntime().runFinalizersOnExit()</code>.   *   * @param finalizeOnExit whether to run finalizers on exit   * @throws SecurityException if permission is denied   * @see Runtime#runFinalizersOnExit()   * @since 1.1   * @deprecated never rely on finalizers to do a clean, thread-safe,   *             mop-up from your code   */  public static void runFinalizersOnExit(boolean finalizeOnExit)  {    Runtime.getRuntime().runFinalizersOnExit(finalizeOnExit);  }  /**   * Load a code file using its explicit system-dependent filename. A security   * check may be performed, <code>checkLink</code>. This just calls   * <code>Runtime.getRuntime().load(filename)</code>.   *   * @param filename the code file to load   * @throws SecurityException if permission is denied   * @throws UnsatisfiedLinkError if the file cannot be loaded   * @see Runtime#load(String)   */  public static void load(String filename)  {    Runtime.getRuntime().load(filename);  }  /**   * Load a library using its explicit system-dependent filename. A security   * check may be performed, <code>checkLink</code>. This just calls   * <code>Runtime.getRuntime().load(filename)</code>.   *   * @param libname the library file to load   * @throws SecurityException if permission is denied   * @throws UnsatisfiedLinkError if the file cannot be loaded   * @see Runtime#load(String)   */  public static void loadLibrary(String libname)  {    Runtime.getRuntime().loadLibrary(libname);  }  /**   * Convert a library name to its platform-specific variant.   *   * @param libname the library name, as used in <code>loadLibrary</code>   * @return the platform-specific mangling of the name   * @since 1.2   */  public static String mapLibraryName(String libname)  {    // XXX Fix this!!!!    return Runtime.nativeGetLibname("", libname);  }  /**   * Detect big-endian systems.   *   * @return true if the system is big-endian.   */  static native boolean isWordsBigEndian();  /**   * Set {@link #in} to a new InputStream.   *   * @param in the new InputStream   * @see #setIn(InputStream)   */  private static native void setIn0(InputStream in);  /**   * Set {@link #out} to a new PrintStream.   *   * @param out the new PrintStream   * @see #setOut(PrintStream)   */  private static native void setOut0(PrintStream out);  /**   * Set {@link #err} to a new PrintStream.   *   * @param err the new PrintStream   * @see #setErr(PrintStream)   */  private static native void setErr0(PrintStream err);  /**   * Gets the value of an environment variable.   *   * @see #getenv(String)   */  static native String getenv0(String name);} // class System

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -