zoukankan      html  css  js  c++  java
  • JAVA获得系统配置文件的System Properties

    Code:

    import java.util.*;
    import java.util.Map.Entry;
    
    public class SystemProperties
    {
        public static void main(String[] args)
        {
            Properties properties = System.getProperties();
            Iterator<Entry<Object, Object>> iterator = properties.entrySet().iterator();
            while (iterator.hasNext())
            {
                Entry<Object, Object> entry = iterator.next();
                System.out.println(entry.getKey() + "===" + entry.getValue());
            }
        }
    }
    
    

    Result:

    java.runtime.name===Java(TM) SE Runtime Environment
    sun.boot.library.path===H:ProgramFilesJavajdk1.7.0_51jrein
    java.vm.version===24.51-b03
    java.vm.vendor===Oracle Corporation
    java.vendor.url===http://java.oracle.com/
    path.separator===;
    java.vm.name===Java HotSpot(TM) Client VM
    file.encoding.pkg===sun.io
    user.country===CN
    user.script===
    sun.java.launcher===SUN_STANDARD
    sun.os.patch.level===Service Pack 1
    java.vm.specification.name===Java Virtual Machine Specification
    user.dir===H:WorksworkspaceTT
    java.runtime.version===1.7.0_51-b13
    java.awt.graphicsenv===sun.awt.Win32GraphicsEnvironment
    java.endorsed.dirs===H:ProgramFilesJavajdk1.7.0_51jrelibendorsed
    os.arch===x86
    java.io.tmpdir===C:UserschenjoAppDataLocalTemp
    line.separator===
    
    java.vm.specification.vendor===Oracle Corporation
    user.variant===
    os.name===Windows 7
    sun.jnu.encoding===GBK
    java.library.path===H:ProgramFilesJavajdk1.7.0_51in;C:WindowsSunJavain;C:Windowssystem32;C:Windows;H:/ProgramFiles/Java/jre1.8.0_212/bin/server;H:/ProgramFiles/Java/jre1.8.0_212/bin;H:/ProgramFiles/Java/jre1.8.0_212/lib/amd64;%MYSQL_HOME%in;C:Program Files (x86)Common FilesOracleJavajavapath;H:ProgramFiles(x86)NetSarangXshell6;H:ProgramFilesPython3;H:ProgramFilesPython3Scripts;H:ProgramFilesPython3Scripts;H:ProgramFilesPython3;H:oraclexeapporacleproduct11.2.0serverin;C:Program Files (x86)NVIDIA CorporationPhysXCommon;C:Program Files (x86)InteliCLS Client;C:Program FilesInteliCLS Client;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:Program FilesIntelIntel(R) Management Engine ComponentsDAL;C:Program FilesIntelIntel(R) Management Engine ComponentsIPT;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsDAL;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsIPT;H:AppsSikuliX;C:Program FilesMicrosoft SQL Server130ToolsBinn;H:ProgramFiles
    odejs;h:ProgramFilesCloudFoundry;H:ProgramFilesPuTTY;H:ProgramFilesTortoiseSVNin;C:Program FilesMicrosoft VS Codein;h:ProgramFilesGitcmd;G:Goin;H:Appsgradle-4.8.1in;H:ProgramFilesPython27;H:AppsJspStudyMySQLin;H:ProgramFilesJavajdk1.8.0_212in;H:Appsspring-boot-cli-1.4.2in;H:Appsmaven-3.2.3in;H:AppsRuby193in;G:programsSikuli-1.0.1libs;.;H:Appsjython2.5.3;H:Appsgroovy-2.5.7in;H:Appsscala-2.11.4in;H:Appsapache-ant-1.9.4in;H:ProgramFilesPython3;H:ProgramFilesPython3Scripts;G:goin;G:mygoin;H:Appssbtin;G:programsSikuli-1.0.1;G:programsSikuli-1.0.1libs;H:Appssqlite-shell-3.8.8.2;H:ProgramFiles(x86)CodeBlocksMinGWin;C:UserschenjoAppDataRoaming
    pm;C:UserschenjoAppDataRoaming
    pm;;C:Program FilesMicrosoft VS Codein;C:Userschenjogoin;h:ProgramFilesJetBrainsIntelliJIDEA2019.1.3in;;h:ProgramFilesJetBrainsGoLand2019.3in;;;H:Appseclipse-jee-indigo;;.
    java.specification.name===Java Platform API Specification
    java.class.version===51.0
    sun.management.compiler===HotSpot Client Compiler
    os.version===6.1
    user.home===C:Userschenjo
    user.timezone===
    java.awt.printerjob===sun.awt.windows.WPrinterJob
    file.encoding===UTF-8
    java.specification.version===1.7
    java.class.path===H:WorksworkspaceTTin
    user.name===chenjo
    java.vm.specification.version===1.7
    sun.java.command===SystemProperties
    java.home===H:ProgramFilesJavajdk1.7.0_51jre
    sun.arch.data.model===32
    user.language===zh
    java.specification.vendor===Oracle Corporation
    awt.toolkit===sun.awt.windows.WToolkit
    java.vm.info===mixed mode, sharing
    java.version===1.7.0_51
    java.ext.dirs===H:ProgramFilesJavajdk1.7.0_51jrelibext;C:WindowsSunJavalibext
    sun.boot.class.path===H:ProgramFilesJavajdk1.7.0_51jrelib
    esources.jar;H:ProgramFilesJavajdk1.7.0_51jrelib
    t.jar;H:ProgramFilesJavajdk1.7.0_51jrelibsunrsasign.jar;H:ProgramFilesJavajdk1.7.0_51jrelibjsse.jar;H:ProgramFilesJavajdk1.7.0_51jrelibjce.jar;H:ProgramFilesJavajdk1.7.0_51jrelibcharsets.jar;H:ProgramFilesJavajdk1.7.0_51jrelibjfr.jar;H:ProgramFilesJavajdk1.7.0_51jreclasses
    java.vendor===Oracle Corporation
    file.separator===
    java.vendor.url.bug===http://bugreport.sun.com/bugreport/
    sun.io.unicode.encoding===UnicodeLittle
    sun.cpu.endian===little
    sun.desktop===windows
    sun.cpu.isalist===pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86
    
    
  • 相关阅读:
    Java8性能优化之字符串拼接
    Java8字符串分割的几种方式及性能比较
    【Collections:集合工具类:常用方法】
    【ArrayList嵌套HashMap】
    【集合工具类:Collections】
    【HashMap 嵌套 HashMap】
    【HashMap 嵌套 ArrayList】
    【TreeMapDemo】
    【LinkedHashMap】
    【TreeMap】
  • 原文地址:https://www.cnblogs.com/chenjo/p/12952397.html
Copyright © 2011-2022 走看看