< prev index next >

src/java.base/share/classes/java/lang/System.java

Print this page




 559      * <dt>user.dir             <dd>User's current working directory
 560      * </dl>
 561      */
 562 
 563     private static Properties props;
 564     private static native Properties initProperties(Properties props);
 565 
 566     /**
 567      * Determines the current system properties.
 568      * <p>
 569      * First, if there is a security manager, its
 570      * <code>checkPropertiesAccess</code> method is called with no
 571      * arguments. This may result in a security exception.
 572      * <p>
 573      * The current set of system properties for use by the
 574      * {@link #getProperty(String)} method is returned as a
 575      * <code>Properties</code> object. If there is no current set of
 576      * system properties, a set of system properties is first created and
 577      * initialized. This set of system properties always includes values
 578      * for the following keys:
 579      * <table summary="Shows property keys and associated values">


 580      * <tr><th>Key</th>
 581      *     <th>Description of Associated Value</th></tr>


 582      * <tr><td><code>java.version</code></td>
 583      *     <td>Java Runtime Environment version which may be interpreted
 584      *     as a {@link Runtime.Version}</td></tr>
 585      * <tr><td><code>java.vendor</code></td>
 586      *     <td>Java Runtime Environment vendor</td></tr>
 587      * <tr><td><code>java.vendor.url</code></td>
 588      *     <td>Java vendor URL</td></tr>
 589      * <tr><td><code>java.home</code></td>
 590      *     <td>Java installation directory</td></tr>
 591      * <tr><td><code>java.vm.specification.version</code></td>
 592      *     <td>Java Virtual Machine specification version which may be
 593      *     interpreted as a {@link Runtime.Version}</td></tr>
 594      * <tr><td><code>java.vm.specification.vendor</code></td>
 595      *     <td>Java Virtual Machine specification vendor</td></tr>
 596      * <tr><td><code>java.vm.specification.name</code></td>
 597      *     <td>Java Virtual Machine specification name</td></tr>
 598      * <tr><td><code>java.vm.version</code></td>
 599      *     <td>Java Virtual Machine implementation version which may be
 600      *     interpreted as a {@link Runtime.Version}</td></tr>
 601      * <tr><td><code>java.vm.vendor</code></td>


 620      * <tr><td><code>java.compiler</code></td>
 621      *     <td>Name of JIT compiler to use</td></tr>
 622      * <tr><td><code>os.name</code></td>
 623      *     <td>Operating system name</td></tr>
 624      * <tr><td><code>os.arch</code></td>
 625      *     <td>Operating system architecture</td></tr>
 626      * <tr><td><code>os.version</code></td>
 627      *     <td>Operating system version</td></tr>
 628      * <tr><td><code>file.separator</code></td>
 629      *     <td>File separator ("/" on UNIX)</td></tr>
 630      * <tr><td><code>path.separator</code></td>
 631      *     <td>Path separator (":" on UNIX)</td></tr>
 632      * <tr><td><code>line.separator</code></td>
 633      *     <td>Line separator ("\n" on UNIX)</td></tr>
 634      * <tr><td><code>user.name</code></td>
 635      *     <td>User's account name</td></tr>
 636      * <tr><td><code>user.home</code></td>
 637      *     <td>User's home directory</td></tr>
 638      * <tr><td><code>user.dir</code></td>
 639      *     <td>User's current working directory</td></tr>

 640      * </table>
 641      * <p>
 642      * Multiple paths in a system property value are separated by the path
 643      * separator character of the platform.
 644      * <p>
 645      * Note that even if the security manager does not permit the
 646      * <code>getProperties</code> operation, it may choose to permit the
 647      * {@link #getProperty(String)} operation.
 648      *
 649      * @implNote In addition to the standard system properties, the system
 650      * properties may include the following keys:
 651      * <table summary="Shows property keys and associated values">


 652      * <tr><th>Key</th>
 653      *     <th>Description of Associated Value</th></tr>


 654      * <tr><td>{@code jdk.module.path}</td>
 655      *     <td>The application module path</td></tr>
 656      * <tr><td>{@code jdk.module.upgrade.path}</td>
 657      *     <td>The upgrade module path</td></tr>
 658      * <tr><td>{@code jdk.module.main}</td>
 659      *     <td>The module name of the initial/main module</td></tr>
 660      * <tr><td>{@code jdk.module.main.class}</td>
 661      *     <td>The main class name of the initial module</td></tr>

 662      * </table>
 663      *
 664      * @return     the system properties
 665      * @exception  SecurityException  if a security manager exists and its
 666      *             <code>checkPropertiesAccess</code> method doesn't allow access
 667      *              to the system properties.
 668      * @see        #setProperties
 669      * @see        java.lang.SecurityException
 670      * @see        java.lang.SecurityManager#checkPropertiesAccess()
 671      * @see        java.util.Properties
 672      */
 673     public static Properties getProperties() {
 674         SecurityManager sm = getSecurityManager();
 675         if (sm != null) {
 676             sm.checkPropertiesAccess();
 677         }
 678 
 679         return props;
 680     }
 681 




 559      * <dt>user.dir             <dd>User's current working directory
 560      * </dl>
 561      */
 562 
 563     private static Properties props;
 564     private static native Properties initProperties(Properties props);
 565 
 566     /**
 567      * Determines the current system properties.
 568      * <p>
 569      * First, if there is a security manager, its
 570      * <code>checkPropertiesAccess</code> method is called with no
 571      * arguments. This may result in a security exception.
 572      * <p>
 573      * The current set of system properties for use by the
 574      * {@link #getProperty(String)} method is returned as a
 575      * <code>Properties</code> object. If there is no current set of
 576      * system properties, a set of system properties is first created and
 577      * initialized. This set of system properties always includes values
 578      * for the following keys:
 579      * <table class="striped">
 580      * <caption style="display:none">Shows property keys and associated values</caption>
 581      * <thead>
 582      * <tr><th>Key</th>
 583      *     <th>Description of Associated Value</th></tr>
 584      * </thead>
 585      * <tbody>
 586      * <tr><td><code>java.version</code></td>
 587      *     <td>Java Runtime Environment version which may be interpreted
 588      *     as a {@link Runtime.Version}</td></tr>
 589      * <tr><td><code>java.vendor</code></td>
 590      *     <td>Java Runtime Environment vendor</td></tr>
 591      * <tr><td><code>java.vendor.url</code></td>
 592      *     <td>Java vendor URL</td></tr>
 593      * <tr><td><code>java.home</code></td>
 594      *     <td>Java installation directory</td></tr>
 595      * <tr><td><code>java.vm.specification.version</code></td>
 596      *     <td>Java Virtual Machine specification version which may be
 597      *     interpreted as a {@link Runtime.Version}</td></tr>
 598      * <tr><td><code>java.vm.specification.vendor</code></td>
 599      *     <td>Java Virtual Machine specification vendor</td></tr>
 600      * <tr><td><code>java.vm.specification.name</code></td>
 601      *     <td>Java Virtual Machine specification name</td></tr>
 602      * <tr><td><code>java.vm.version</code></td>
 603      *     <td>Java Virtual Machine implementation version which may be
 604      *     interpreted as a {@link Runtime.Version}</td></tr>
 605      * <tr><td><code>java.vm.vendor</code></td>


 624      * <tr><td><code>java.compiler</code></td>
 625      *     <td>Name of JIT compiler to use</td></tr>
 626      * <tr><td><code>os.name</code></td>
 627      *     <td>Operating system name</td></tr>
 628      * <tr><td><code>os.arch</code></td>
 629      *     <td>Operating system architecture</td></tr>
 630      * <tr><td><code>os.version</code></td>
 631      *     <td>Operating system version</td></tr>
 632      * <tr><td><code>file.separator</code></td>
 633      *     <td>File separator ("/" on UNIX)</td></tr>
 634      * <tr><td><code>path.separator</code></td>
 635      *     <td>Path separator (":" on UNIX)</td></tr>
 636      * <tr><td><code>line.separator</code></td>
 637      *     <td>Line separator ("\n" on UNIX)</td></tr>
 638      * <tr><td><code>user.name</code></td>
 639      *     <td>User's account name</td></tr>
 640      * <tr><td><code>user.home</code></td>
 641      *     <td>User's home directory</td></tr>
 642      * <tr><td><code>user.dir</code></td>
 643      *     <td>User's current working directory</td></tr>
 644      * </tbody>
 645      * </table>
 646      * <p>
 647      * Multiple paths in a system property value are separated by the path
 648      * separator character of the platform.
 649      * <p>
 650      * Note that even if the security manager does not permit the
 651      * <code>getProperties</code> operation, it may choose to permit the
 652      * {@link #getProperty(String)} operation.
 653      *
 654      * @implNote In addition to the standard system properties, the system
 655      * properties may include the following keys:
 656      * <table class="striped">
 657      * <caption style="display:none">Shows property keys and associated values</caption>
 658      * <thead>
 659      * <tr><th>Key</th>
 660      *     <th>Description of Associated Value</th></tr>
 661      * </thead>
 662      * <tbody>
 663      * <tr><td>{@code jdk.module.path}</td>
 664      *     <td>The application module path</td></tr>
 665      * <tr><td>{@code jdk.module.upgrade.path}</td>
 666      *     <td>The upgrade module path</td></tr>
 667      * <tr><td>{@code jdk.module.main}</td>
 668      *     <td>The module name of the initial/main module</td></tr>
 669      * <tr><td>{@code jdk.module.main.class}</td>
 670      *     <td>The main class name of the initial module</td></tr>
 671      * </tbody>
 672      * </table>
 673      *
 674      * @return     the system properties
 675      * @exception  SecurityException  if a security manager exists and its
 676      *             <code>checkPropertiesAccess</code> method doesn't allow access
 677      *              to the system properties.
 678      * @see        #setProperties
 679      * @see        java.lang.SecurityException
 680      * @see        java.lang.SecurityManager#checkPropertiesAccess()
 681      * @see        java.util.Properties
 682      */
 683     public static Properties getProperties() {
 684         SecurityManager sm = getSecurityManager();
 685         if (sm != null) {
 686             sm.checkPropertiesAccess();
 687         }
 688 
 689         return props;
 690     }
 691 


< prev index next >