< prev index next >

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

Print this page




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


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


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


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

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


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


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

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




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


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


< prev index next >