zoukankan      html  css  js  c++  java
  • System类--打印当前虚拟机的所有环境变量和变量和值

    package test;
    
    import java.util.Enumeration;
    import java.util.Properties;
    
    public class SystemInfo {
        public static void main(String[] args) {
            Properties sp = System.getProperties(); //获取当前虚拟机的环境属性
               Enumeration e = sp.propertyNames();//获取环境属性中所有的变量
               while(e.hasMoreElements()) {
                String key = (String)e.nextElement();
                System.out.println(key + " = " + sp.getProperty(key));
            }
        }
    }

    console:

    java.runtime.name = Java(TM) SE Runtime Environment
    sun.boot.library.path = D:Javajre1.8.0_144in
    java.vm.version = 25.144-b01
    java.vm.vendor = Oracle Corporation
    java.vendor.url = http://java.oracle.com/
    path.separator = ;
    java.vm.name = Java HotSpot(TM) 64-Bit Server VM
    file.encoding.pkg = sun.io
    user.script =
    user.country = CN
    sun.java.launcher = SUN_STANDARD
    sun.os.patch.level = Service Pack 1
    java.vm.specification.name = Java Virtual Machine Specification
    user.dir = D:eclipse-workspaceJavaTest
    java.runtime.version = 1.8.0_144-b01
    java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
    java.endorsed.dirs = D:Javajre1.8.0_144libendorsed
    os.arch = amd64
    java.io.tmpdir = C:UserssinosoftAppDataLocalTemp
    line.separator =

    java.vm.specification.vendor = Oracle Corporation
    user.variant =
    os.name = Windows 7
    sun.jnu.encoding = GBK
    java.library.path = D:Javajre1.8.0_144in;C:WindowsSunJavain;C:Windowssystem32;C:Windows;D:/Java/jre1.8.0_144/bin/server;D:/Java/jre1.8.0_144/bin;D:/Java/jre1.8.0_144/lib/amd64;C:ProgramDataOracleJavajavapath;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;D:Javajdk1.8.0_144in;D:Program FilesTortoiseSVNin;E:eclipse-jee-oxygen-3a-win32-x86_64eclipse;;.
    java.specification.name = Java Platform API Specification
    java.class.version = 52.0
    sun.management.compiler = HotSpot 64-Bit Tiered Compilers
    os.version = 6.1
    user.home = C:Userssinosoft
    user.timezone =
    java.awt.printerjob = sun.awt.windows.WPrinterJob
    file.encoding = GBK
    java.specification.version = 1.8
    user.name = sinosoft
    java.class.path = D:Javajre1.8.0_144lib esources.jar;D:Javajre1.8.0_144lib t.jar;D:Javajre1.8.0_144libjsse.jar;D:Javajre1.8.0_144libjce.jar;D:Javajre1.8.0_144libcharsets.jar;D:Javajre1.8.0_144libjfr.jar;D:Javajre1.8.0_144libextaccess-bridge-64.jar;D:Javajre1.8.0_144libextcldrdata.jar;D:Javajre1.8.0_144libextdnsns.jar;D:Javajre1.8.0_144libextjaccess.jar;D:Javajre1.8.0_144libextjfxrt.jar;D:Javajre1.8.0_144libextlocaledata.jar;D:Javajre1.8.0_144libext ashorn.jar;D:Javajre1.8.0_144libextsunec.jar;D:Javajre1.8.0_144libextsunjce_provider.jar;D:Javajre1.8.0_144libextsunmscapi.jar;D:Javajre1.8.0_144libextsunpkcs11.jar;D:Javajre1.8.0_144libextzipfs.jar;D:eclipse-workspaceJavaTestin
    java.vm.specification.version = 1.8
    sun.arch.data.model = 64
    java.home = D:Javajre1.8.0_144
    sun.java.command = test.SystemInfo
    java.specification.vendor = Oracle Corporation
    user.language = zh
    awt.toolkit = sun.awt.windows.WToolkit
    java.vm.info = mixed mode
    java.version = 1.8.0_144
    java.ext.dirs = D:Javajre1.8.0_144libext;C:WindowsSunJavalibext
    sun.boot.class.path = D:Javajre1.8.0_144lib esources.jar;D:Javajre1.8.0_144lib t.jar;D:Javajre1.8.0_144libsunrsasign.jar;D:Javajre1.8.0_144libjsse.jar;D:Javajre1.8.0_144libjce.jar;D:Javajre1.8.0_144libcharsets.jar;D:Javajre1.8.0_144libjfr.jar;D:Javajre1.8.0_144classes
    java.vendor = Oracle Corporation
    file.separator =
    java.vendor.url.bug = http://bugreport.sun.com/bugreport/
    sun.cpu.endian = little
    sun.io.unicode.encoding = UnicodeLittle
    sun.desktop = windows
    sun.cpu.isalist = amd64

    拼命敲
  • 相关阅读:
    SpringCloud学习笔记【七】:Eureka,Consul,Zookeeper注册中心异同点
    SpringCloud学习笔记【六】:Consul实现服务注册与发现
    Docker安装Consul
    SpringCloud学习笔记【五】:Zookeeper代替Eureka实现服务注册与发现
    Docker安装Zookeeper以及Zk常用命令
    SpringCloud学习笔记【四】:Eureka的自我保护机制
    教你如何使用docsify快速部署优美的在线文档
    SpringCloud学习笔记【三】:Actuator微服务信息完善+Discovery获取注册信息
    SpringCloud学习笔记【二】:Eureka服务注册与发现
    WPF应用中一种比较完美的权限控制设计方式
  • 原文地址:https://www.cnblogs.com/wuyuwuyueping/p/9377519.html
Copyright © 2011-2022 走看看