测试代码:
public class TestSys {public static void main(String[] args) {/*** 获取所有的系统环境变量*/Map<String, String> map = System.getenv();map.forEach((key, value) -> System.out.printf("env:key:%s->value:%s%n",key ,value));/*** 获取所有jvm环境变量*/Properties props = System.getProperties();props.forEach((key,value)->System.out.printf("prop:key:%s->value:%s%n",key ,value));}
}
win环境
结果:
env:key:HADOOP_CONF_DIR->value:D:\env\components\hadoop\etc\hadoop
env:key:PROCESSOR_LEVEL->value:15
env:key:gt_installation_dir->value:C:\Program Files (x86)\TelnetServer
env:key:SESSIONNAME->value:Console
env:key:ALLUSERSPROFILE->value:C:\ProgramData
env:key:PROCESSOR_ARCHITECTURE->value:AMD64
env:key:HBASE_CONF_DIR->value:D:\env\components\hbase\conf
env:key:GATEWAY_VM_OPTIONS->value:D:\env\jetbra\vmoptions\gateway.vmoptions
env:key:PSModulePath->value:C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules;D:\env\visual-svn\PowerShellModules
env:key:SystemDrive->value:C:
env:key:MAVEN_HOME->value:D:\env\apache-maven-3.8.6
env:key:MOZ_PLUGIN_PATH->value:D:\programs\foxit_pdf\Foxit PDF Reader\plugins\
env:key:ENV_SVC_FLAG->value:0
env:key:RIDER_VM_OPTIONS->value:D:\env\jetbra\vmoptions\rider.vmoptions
env:key:FLINK_CONF_DIR->value:D:\env\components\flink\conf
env:key:DEVECOSTUDIO_VM_OPTIONS->value:D:\env\jetbra\vmoptions\devecostudio.vmoptions
env:key:STUDIO_VM_OPTIONS->value:D:\env\jetbra\vmoptions\studio.vmoptions
env:key:ProgramFiles(x86)->value:C:\Program Files (x86)
env:key:VISUALSVN_SERVER->value:D:\env\visual-svn\
env:key:PATHEXT->value:.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW
env:key:APPCODE_VM_OPTIONS->value:D:\env\jetbra\vmoptions\appcode.vmoptions
env:key:DriverData->value:C:\Windows\System32\Drivers\DriverData
env:key:SPARK_CONF_DIR->value:D:\env\components\spark\conf
env:key:DATASPELL_VM_OPTIONS->value:D:\env\jetbra\vmoptions\dataspell.vmoptions
env:key:ProgramData->value:C:\ProgramData
env:key:KERBEROS_CONFIG_HOME->value:D:\env\Kerberos
env:key:ProgramW6432->value:C:\Program Files
env:key:MYSQL_HOME->value:D:\env\mysql-5.7.32-winx64
env:key:PROCESSOR_IDENTIFIER->value:Intel64 Family 15 Model 6 Stepping 3, GenuineIntel
env:key:HADOOP_HOME->value:D:\env\components\hadoop
env:key:ProgramFiles->value:C:\Program Files
env:key:PUBLIC->value:C:\Users\Public
env:key:windir->value:C:\Windows
env:key:=::->value:::\
env:key:DATAGRIP_VM_OPTIONS->value:D:\env\jetbra\vmoptions\datagrip.vmoptions
env:key:ChocolateyLastPathUpdate->value:133202366705513289
env:key:LOGONSERVER->value:\\UNIS-DC01-AD
env:key:PYCHARM_VM_OPTIONS->value:D:\env\jetbra\vmoptions\pycharm.vmoptions
env:key:WEBSTORM_VM_OPTIONS->value:D:\env\jetbra\vmoptions\webstorm.vmoptions
env:key:JAVA_HOME->value:D:\env\jdk1.8.0_261
env:key:CLION_VM_OPTIONS->value:D:\env\jetbra\vmoptions\clion.vmoptions
env:key:JETBRAINSCLIENT_VM_OPTIONS->value:D:\env\jetbra\vmoptions\jetbrainsclient.vmoptions
env:key:WebStorm->value:D:\env\webstorm\WebStorm2020.1\bin;
env:key:KRB5_CONFIG->value:C:\ProgramData\MIT\Kerberos5\krb5.ini
env:key:GRADLE_HOME->value:D:\env\gradle-8.5
env:key:GOLAND_VM_OPTIONS->value:D:\env\jetbra\vmoptions\goland.vmoptions
env:key:GRADLE_USER_HOME->value:D:\env\Maven_Repository
env:key:IDEA_VM_OPTIONS->value:D:\env\jetbra\vmoptions\idea.vmoptions
env:key:HBASE_CLIENT_HOME->value:D:\env\components\hbase\lib
env:key:RUBYMINE_VM_OPTIONS->value:D:\env\jetbra\vmoptions\rubymine.vmoptions
env:key:ChocolateyInstall->value:C:\ProgramData\chocolatey
env:key:JETBRAINS_CLIENT_VM_OPTIONS->value:D:\env\jetbra\vmoptions\jetbrains_client.vmoptions
env:key:NODE_PATH->value:D:\env\nodejs\node_global\node_modules
env:key:SCALA_HOME->value:D:\env\scala\scala-2.11
env:key:CommonProgramFiles->value:C:\Program Files\Common Files
env:key:ROCKSDB_SHAREDLIB_DIR->value:D:\env\rocksdb-shared-lib
env:key:HIVE_CONF_DIR->value:D:\env\components\hive\conf
env:key:PyCharm->value:d:\programs\PyCharm_2020.1\bin;
env:key:OS->value:Windows_NT
env:key:SBT_HOME->value:D:\env\scala-sbt
env:key:PROCESSOR_REVISION->value:0603
env:key:CommonProgramW6432->value:C:\Program Files\Common Files
env:key:ComSpec->value:C:\Windows\system32\cmd.exe
env:key:UATDATA->value:C:\Windows\CCM\UATData\D9F8C395-CAB8-491d-B8AC-179A1FE1BE77
env:key:SystemRoot->value:C:\Windows
env:key:WEBIDE_VM_OPTIONS->value:D:\env\jetbra\vmoptions\webide.vmoptions
env:key:HOMEDRIVE->value:C:
env:key:CommonProgramFiles(x86)->value:C:\Program Files (x86)\Common Files
env:key:NUMBER_OF_PROCESSORS->value:8
env:key:PHPSTORM_VM_OPTIONS->value:D:\env\jetbra\vmoptions\phpstorm.vmoptions
env:key:HBASE_HOME->value:D:\env\components\hbase
prop:key:sun.cpu.isalist->value:amd64
prop:key:sun.desktop->value:windows
prop:key:sun.io.unicode.encoding->value:UnicodeLittle
prop:key:sun.cpu.endian->value:little
prop:key:java.vendor.url.bug->value:http://bugreport.sun.com/bugreport/
prop:key:file.separator->value:\
prop:key:java.vendor->value:Oracle Corporation
prop:key:sun.boot.class.path->value:D:\env\jdk1.8.0_261\jre\lib\resources.jar;D:\env\jdk1.8.0_261\jre\lib\rt.jar;D:\env\jdk1.8.0_261\jre\lib\sunrsasign.jar;D:\env\jdk1.8.0_261\jre\lib\jsse.jar;D:\env\jdk1.8.0_261\jre\lib\jce.jar;D:\env\jdk1.8.0_261\jre\lib\charsets.jar;D:\env\jdk1.8.0_261\jre\lib\jfr.jar;D:\env\jdk1.8.0_261\jre\classes
prop:key:java.ext.dirs->value:D:\env\jdk1.8.0_261\jre\lib\ext;C:\Windows\Sun\Java\lib\ext
prop:key:java.version->value:1.8.0_261
prop:key:java.vm.info->value:mixed mode
prop:key:awt.toolkit->value:sun.awt.windows.WToolkit
prop:key:user.language->value:zh
prop:key:java.specification.vendor->value:Oracle Corporation
prop:key:java.home->value:D:\env\jdk1.8.0_261\jre
prop:key:sun.arch.data.model->value:64
prop:key:java.vm.specification.version->value:1.8
prop:key:java.class.path->value:D:\projects\flink-config\build\classes\java\main;D:\projects\flink-config\build\classes\scala\main;D:\projects\flink-config\build\resources\main;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-slf4j-impl\2.17.0\1ec25ce0254749c94549ea9c3cea34bd0488c9c6\log4j-slf4j-impl-2.17.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.flink\flink-clients_2.11\1.13.6\b428849b24f93b66c559bd92496cf4aaf0c5d187\flink-clients_2.11-1.13.6.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.flink\flink-streaming-java_2.11\1.13.6\dfc2b84e62945ed634cf20a5f54f6826c2d9c067\flink-streaming-java_2.11-1.13.6.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.hadoop\hadoop-common\3.0.0-cdh6.2.0\aa9ba39c361ed51c3c4141fe72ed5414692170b7\hadoop-common-3.0.0-cdh6.2.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.flink\flink-optimizer_2.11\1.13.6\99da1027ceb4c1a467874ce0cbfdf33c62c8c47\flink-optimizer_2.11-1.13.6.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.flink\flink-runtime_2.11\1.13.6\456d6075ba9d812132f169bea8a1eca5c1317c8c\flink-runtime_2.11-1.13.6.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.flink\flink-java\1.13.6\e98a6bcc50111355dd7c2e3256421dec11d4677e\flink-java-1.13.6.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.flink\flink-file-sink-common\1.13.6\c1b31cdec7c31773f2a8a3d2e1117c6363f80b88\flink-file-sink-common-1.13.6.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.flink\flink-hadoop-fs\1.13.6\ac6fb53f4f83e3c79698cf4d127d51907eed1846\flink-hadoop-fs-1.13.6.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.flink\flink-core\1.13.6\48ecd5c70ff80dda62b6eb72a10928b44f23e18e\flink-core-1.13.6.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.hadoop\hadoop-auth\3.0.0-cdh6.2.0\b38bab041b336d3011730d5ed486e6fb6f091f3d\hadoop-auth-3.0.0-cdh6.2.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.curator\curator-recipes\2.12.0\6903f92106c900a6bdf814067d257eaf0c4007c4\curator-recipes-2.12.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.curator\curator-framework\2.12.0\fd8ffa050e7c7606dfe7dfb82d2944d8e5f1d0a3\curator-framework-2.12.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.curator\curator-client\2.12.0\450fb6ec9fbd7f5e2c099be80e0473e4f06d994e\curator-client-2.12.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.zookeeper\zookeeper\3.4.8\933ea2ed15e6a0e24b788973e3d128ff163c3136\zookeeper-3.4.8.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.slf4j\slf4j-log4j12\1.7.25\110cefe2df103412849d72ef7a67e4e91e4266b4\slf4j-log4j12-1.7.25.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.avro\avro\1.8.2-cdh6.2.0\93813fd2308ecf5b3ce3ed0e5c158bc47102e300\avro-1.8.2-cdh6.2.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.flink\flink-annotations\1.13.6\cc1d68d83a68c7cc7e658176addba63911fdd68d\flink-annotations-1.13.6.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.typesafe.akka\akka-slf4j_2.11\2.5.21\432b7c8f844df7afb6359cf2212dd9058b9a9545\akka-slf4j_2.11-2.5.21.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.clapper\grizzled-slf4j_2.11\1.3.2\8e83c864c7a16b391bd6e4099a9c40a437781aea\grizzled-slf4j_2.11-1.3.2.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.kerby\kerb-simplekdc\1.0.0\5f4af066de8b3c3f43ee0dac5cd9f71ea37624ae\kerb-simplekdc-1.0.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.kerby\kerb-client\1.0.0\bdfdcfde4edbb6b8bae9d284ce840af3c9dfb7f0\kerb-client-1.0.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.kerby\kerb-admin\1.0.0\6439f279d2798caa6f58af8b4460f5832a3e5c43\kerb-admin-1.0.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.kerby\kerb-server\1.0.0\f6d644981466f8f684056209379f3465bf0b0fe3\kerb-server-1.0.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.kerby\kerb-common\1.0.0\df879a60deb23c420134d9cdb626f9f83f8b7d6f\kerb-common-1.0.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.kerby\kerb-util\1.0.0\77dba4d1deaf1a58a82b359af5cdf9b0612f627f\kerb-util-1.0.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.kerby\kerb-identity\1.0.0\565b8d0e3637447317bb6d03569a7bc493a68985\kerb-identity-1.0.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.kerby\kerby-config\1.0.0\6ef9a690f3ce77a825e6a65df941b367801897a1\kerby-config-1.0.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.kerby\kerb-crypto\1.0.0\c9d1e54753d0e98f28cec0c0d287cd606b04346a\kerb-crypto-1.0.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.kerby\kerb-core\1.0.0\e511694cdecc258545b291e1972c90e87ee045d6\kerb-core-1.0.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.kerby\kerby-pkix\1.0.0\df30f98ed41477cbeb80acde5ce4d9dad8a8c396\kerby-pkix-1.0.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.25\da76ca59f6a57ee3102f8f9bd9cee742973efa8a\slf4j-api-1.7.25.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-core\2.17.0\fe6e7a32c1228884b9691a744f953a55d0dd8ead\log4j-core-2.17.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.17.0\bbd791e9c8c9421e45337c4fe0a10851c086e36c\log4j-api-2.17.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\commons-cli\commons-cli\1.3.1\1303efbc4b181e5a58bf2e967dc156a3132b97c0\commons-cli-1.3.1.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.google.code.findbugs\jsr305\3.0.0\5871fb60dc68d67da54a663c3fd636a10a532948\jsr305-3.0.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.flink\flink-metrics-core\1.13.6\e4e7d4354c9ba59e158c4939b2b72452021758aa\flink-metrics-core-1.13.6.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.flink\flink-queryable-state-client-java\1.13.6\69a1183c156aa7ec139b13eeec67e382f12b78da\flink-queryable-state-client-java-1.13.6.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.flink\force-shading\1.13.6\41ef53dedb7717dca174e856e8ab17be7a76bae2\force-shading-1.13.6.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.flink\flink-shaded-guava\18.0-13.0\b81bc03a19eae90c447f5856ddce8af3db52f6c7\flink-shaded-guava-18.0-13.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.commons\commons-math3\3.5\13af68e9a11576953f5c4b09436f8207be9d3a27\commons-math3-3.5.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.hadoop\hadoop-annotations\3.0.0-cdh6.2.0\cb9c0ef97ac2844cd01dab13c6643bd6609b231a\hadoop-annotations-3.0.0-cdh6.2.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.google.guava\guava\16.0.1\5fa98cd1a63c99a44dd8d3b77e4762b066a5d0c5\guava-16.0.1.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.httpcomponents\httpclient\4.5.3\d1577ae15f01ef5438c5afc62162457c00a34713\httpclient-4.5.3.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\commons-codec\commons-codec\1.11\3acb4705652e16236558f0f4f2192cc33c3bd189\commons-codec-1.11.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\commons-io\commons-io\2.8.0\92999e26e6534606b5678014e66948286298a35c\commons-io-2.8.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\commons-net\commons-net\3.1\2298164a7c2484406f2aa5ac85b205d39019896f\commons-net-3.1.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\commons-beanutils\commons-beanutils\1.9.3\c845703de334ddc6b4b3cd26835458cb1cba1f3d\commons-beanutils-1.9.3.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\commons-collections\commons-collections\3.2.2\8ad72fe39fa8c91eaaf12aadb21e0c3661fe26d5\commons-collections-3.2.2.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-webapp\9.3.25.v20180904\c0f1c2909645de527ed55aef125765806ed6c826\jetty-webapp-9.3.25.v20180904.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-servlet\9.3.25.v20180904\a7c9decb77747421b93e7ec32d2721fe12101928\jetty-servlet-9.3.25.v20180904.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-security\9.3.25.v20180904\da09208e093b9af8090cb9e830cc4c88da63e284\jetty-security-9.3.25.v20180904.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-server\9.3.25.v20180904\4f93d01a0adf648157b39cd675f5553ff6ec2e47\jetty-server-9.3.25.v20180904.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\javax.servlet\javax.servlet-api\3.1.0\3cd63d075497751784b2fa84be59432f4905bf7c\javax.servlet-api-3.1.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-http\9.3.25.v20180904\bf2043a3dae5b7ba1aa330b4cd7f7d9852bd47a5\jetty-http-9.3.25.v20180904.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-io\9.3.25.v20180904\eb22b9233c287befc0013545f9063c95b5825ab1\jetty-io-9.3.25.v20180904.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-xml\9.3.25.v20180904\1b40e3ce82f01aa544c143eeebe7dbb7a382a30b\jetty-xml-9.3.25.v20180904.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-util\9.3.25.v20180904\c50b6a54e08942d06f2c8be0c5e66c7144845c81\jetty-util-9.3.25.v20180904.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\javax.servlet.jsp\jsp-api\2.1\63f943103f250ef1f3a4d5e94d145a0f961f5316\jsp-api-2.1.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.sun.jersey\jersey-json\1.19\12491ab748d2bee7be96629a749f361154e6705f\jersey-json-1.19.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.sun.jersey\jersey-servlet\1.19\2f19f1f7096d0fe3e09ae5698e4427114c23ad03\jersey-servlet-1.19.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.sun.jersey\jersey-server\1.19\ee2ff839a65097eb12004edd909bcb4a97a2832c\jersey-server-1.19.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.sun.jersey\jersey-core\1.19\9a0619e2c514a79b610f17cadaae619c0a08d6a6\jersey-core-1.19.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.commons\commons-configuration2\2.1.1\d97d5b3f8b58c52730d47e1a63c8d3258f41ca6c\commons-configuration2-2.1.1.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\commons-logging\commons-logging\1.2\4bfc12adfe4842bf07b657f0369c4cb522955686\commons-logging-1.2.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\log4j\log4j\1.2.17\5af35056b4d257e4b64b9e8069c0746e8b08629f\log4j-1.2.17.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\commons-lang\commons-lang\2.6\ce1edb914c94ebc388f086c6827e8bdeec71ac2\commons-lang-2.6.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.commons\commons-lang3\3.7\557edd918fd41f9260963583ebf5a61a43a6b423\commons-lang3-3.7.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.google.re2j\re2j\1.1\d716952ab58aa4369ea15126505a36544d50a333\re2j-1.1.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.google.protobuf\protobuf-java\2.5.0\a10732c76bfacdbd633a7eb0f7968b1059a65dfa\protobuf-java-2.5.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.google.code.gson\gson\2.2.4\a60a5e993c98c864010053cb901b7eab25306568\gson-2.2.4.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.jcraft\jsch\0.1.54\da3584329a263616e277e15462b387addd1b208d\jsch-0.1.54.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.htrace\htrace-core4\4.1.0-incubating\12b3e2adda95e8c41d9d45d33db075137871d2e2\htrace-core4-4.1.0-incubating.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.commons\commons-compress\1.21\4ec95b60d4e86b5c95a0e919cb172a0af98011ef\commons-compress-1.21.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.9.8\11283f21cc480aa86c4df7a0a3243ec508372ed2\jackson-databind-2.9.8.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.fasterxml.woodstox\woodstox-core\5.0.3\10aa199207fda142eff01cd61c69244877d71770\woodstox-core-5.0.3.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.codehaus.woodstox\stax2-api\3.1.4\ac19014b1e6a7c08aad07fe114af792676b685b7\stax2-api-3.1.4.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.flink\flink-shaded-asm-7\7.1-13.0\a8cf80e70c6cbf3dadb443d471f9bd1d36f1fb01\flink-shaded-asm-7-7.1-13.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.esotericsoftware.kryo\kryo\2.24.0\c6b206e80cfd97e66a1364003724491c757b92f\kryo-2.24.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.flink\flink-shaded-netty\4.1.49.Final-13.0\e2b09f9f6051dc097cf95b7b56aa24ce4f7509ef\flink-shaded-netty-4.1.49.Final-13.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.flink\flink-shaded-jackson\2.12.1-13.0\8d6b180f8d98384fad6fd33c3eb1422690ef95b5\flink-shaded-jackson-2.12.1-13.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.flink\flink-shaded-zookeeper-3\3.4.14-13.0\4b2754191ec9f01acac139ac77176b0b0d8e9d3d\flink-shaded-zookeeper-3-3.4.14-13.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.javassist\javassist\3.24.0-GA\d7466fc2e3af7c023e95c510f06448ad29b225b3\javassist-3.24.0-GA.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.scala-lang\scala-library\2.11.12\bf5534e6fec3d665bd6419c952a929a8bdd4b591\scala-library-2.11.12.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.typesafe.akka\akka-stream_2.11\2.5.21\b38d270d0158d38f103bce546d708155469b89c6\akka-stream_2.11-2.5.21.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.typesafe.akka\akka-actor_2.11\2.5.21\22d15d47c9e33393f09f688b2c58dbc81f960a1e\akka-actor_2.11-2.5.21.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.typesafe.akka\akka-protobuf_2.11\2.5.21\b3e264d1314272f78f2718e77aaa0110fa9af831\akka-protobuf_2.11-2.5.21.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.github.scopt\scopt_2.11\3.5.0\4adcea609ae83ae73be401872f0a36c018b34fea\scopt_2.11-3.5.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.xerial.snappy\snappy-java\1.1.8.3\2c58fa5745831afa3a4290c2ce15553ff13ad0ab\snappy-java-1.1.8.3.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.twitter\chill_2.11\0.7.6\8154b0442f0c3d5954fc132e2f44f7df13d2bfcc\chill_2.11-0.7.6.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.lz4\lz4-java\1.6.0\b49e2b422a5b7145ba7aa0c3f60c13664a5c5acf\lz4-java-1.6.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore\4.4.6\e3fd8ced1f52c7574af952e2e6da0df8df08eb82\httpcore-4.4.6.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\javax.ws.rs\jsr311-api\1.1.1\59033da2a1afd56af1ac576750a8d0b1830d59e6\jsr311-api-1.1.1.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.codehaus.jettison\jettison\1.1\1a01a2a1218fcf9faa2cc2a6ced025bdea687262\jettison-1.1.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.sun.xml.bind\jaxb-impl\2.2.3-1\56baae106392040a45a06d4a41099173425da1e6\jaxb-impl-2.2.3-1.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.codehaus.jackson\jackson-jaxrs\1.9.2\aedf43f1d5005561e531b6bf0d067e4d20f58aba\jackson-jaxrs-1.9.2.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.codehaus.jackson\jackson-xc\1.9.2\437c991a8eb2c8b69ef1dba2eba27fccb9b98448\jackson-xc-1.9.2.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.codehaus.jackson\jackson-mapper-asl\1.9.13-cloudera.1\d2f4f52b5e6646874beb5df298e34ea7777e6042\jackson-mapper-asl-1.9.13-cloudera.1.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.codehaus.jackson\jackson-core-asl\1.9.13\3c304d70f42f832e0a86d45bd437f692129299a4\jackson-core-asl-1.9.13.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.thoughtworks.paranamer\paranamer\2.8\619eba74c19ccf1da8ebec97a2d7f8ba05773dd6\paranamer-2.8.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.tukaani\xz\1.6\5b6f921f1810bdf90e25471968f741f87168b64\xz-1.6.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.nimbusds\nimbus-jose-jwt\4.41.1\290f3ff0035bb2f839c77ad8ec39466f31091a8\nimbus-jose-jwt-4.41.1.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\net.minidev\json-smart\2.3\7396407491352ce4fa30de92efb158adb76b5b\json-smart-2.3.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.9.0\7c10d545325e3a6e72e06381afe469fd40eb701\jackson-annotations-2.9.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.9.8\f5a654e4675769c716e5b387830d19b501ca191\jackson-core-2.9.8.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.esotericsoftware.minlog\minlog\1.2\59bfcd171d82f9981a5e242b9e840191f650e209\minlog-1.2.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.objenesis\objenesis\2.1\87c0ea803b69252868d09308b4618f766f135a96\objenesis-2.1.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.typesafe\config\1.3.3\4b68c2d5d0403bb4015520fcfabc88d0cbc4d117\config-1.3.3.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.scala-lang.modules\scala-java8-compat_2.11\0.7.0\a31b1b36bcf0d53657733b5d40c78d5f090a5dea\scala-java8-compat_2.11-0.7.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.reactivestreams\reactive-streams\1.0.2\323964c36556eb0e6209f65c1cef72b53b461ab8\reactive-streams-1.0.2.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.typesafe\ssl-config-core_2.11\0.3.7\6e82461eef336716387f6c233555cf916165c70f\ssl-config-core_2.11-0.3.7.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.twitter\chill-java\0.7.6\a74b8d019d6941d82ff86d1612e382f4a0ae8259\chill-java-0.7.6.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\javax.xml.bind\jaxb-api\2.2.2\aeb3021ca93dde265796d82015beecdcff95bf09\jaxb-api-2.2.2.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\com.github.stephenc.jcip\jcip-annotations\1.0-1\ef31541dd28ae2cefdd17c7ebf352d93e9058c63\jcip-annotations-1.0-1.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\net.minidev\accessors-smart\1.2\c592b500269bfde36096641b01238a8350f8aa31\accessors-smart-1.2.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\jline\jline\0.9.94\99a18e9a44834afdebc467294e1138364c207402\jline-0.9.94.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\io.netty\netty\3.7.0.Final\7a8c35599c68c0bf383df74469aa3e03d9aca87\netty-3.7.0.Final.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.kerby\kerby-xdr\1.0.0\46e54ed74c5b184a77da1e89d5e1eb6c342ce517\kerby-xdr-1.0.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.scala-lang.modules\scala-parser-combinators_2.11\1.1.1\5dbfa7b37ae609f2629f957f399731b58b00a799\scala-parser-combinators_2.11-1.1.1.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\javax.xml.stream\stax-api\1.0-2\d6337b0de8b25e53e81b922352fbea9f9f57ba0b\stax-api-1.0-2.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\javax.activation\activation\1.1\e6cb541461c2834bdea3eb920f1884d1eb508b50\activation-1.1.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.ow2.asm\asm\5.0.4\da08b8cce7bbf903602a25a3a163ae252435795\asm-5.0.4.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.kerby\kerby-asn1\1.0.0\dbe7229d863046d10167a975a73f070541216154\kerby-asn1-1.0.0.jar;D:\env\Maven_Repository\caches\modules-2\files-2.1\org.apache.kerby\kerby-util\1.0.0\4dee86e84235d115a724ae2d05d38d6e1b9998f3\kerby-util-1.0.0.jar
prop:key:file.encoding->value:UTF-8
prop:key:java.specification.version->value:1.8
prop:key:java.awt.printerjob->value:sun.awt.windows.WPrinterJob
prop:key:user.timezone->value:
prop:key:os.version->value:10.0
prop:key:sun.management.compiler->value:HotSpot 64-Bit Tiered Compilers
prop:key:java.specification.name->value:Java Platform API Specification
prop:key:java.class.version->value:52.0
prop:key:sun.jnu.encoding->value:GBK
prop:key:os.name->value:Windows 10
prop:key:user.variant->value:
prop:key:java.vm.specification.vendor->value:Oracle Corporation
prop:key:line.separator->value:prop:key:java.endorsed.dirs->value:D:\env\jdk1.8.0_261\jre\lib\endorsed
prop:key:os.arch->value:amd64
prop:key:add.prop->value:prop_val
prop:key:java.awt.graphicsenv->value:sun.awt.Win32GraphicsEnvironment
prop:key:java.runtime.version->value:1.8.0_261-b12
prop:key:java.vm.specification.name->value:Java Virtual Machine Specification
prop:key:user.dir->value:D:\projects\flink-config
prop:key:user.script->value:
prop:key:sun.java.launcher->value:SUN_STANDARD
prop:key:user.country->value:CN
prop:key:sun.os.patch.level->value:
prop:key:java.vm.name->value:Java HotSpot(TM) 64-Bit Server VM
prop:key:file.encoding.pkg->value:sun.io
prop:key:path.separator->value:;
prop:key:java.vm.vendor->value:Oracle Corporation
prop:key:java.vendor.url->value:http://java.oracle.com/
prop:key:sun.boot.library.path->value:D:\env\jdk1.8.0_261\jre\bin
prop:key:java.vm.version->value:25.261-b12
prop:key:java.runtime.name->value:Java(TM) SE Runtime Environment
(1)System.getEnv()
获取的都是,系统环境变量
(2)System.getProperty()
获取的都是java环境变量,可以通过System.setProperty()
设置
linux环境
执行jar
java -jar xxx-config-1.0.jar
结果:
env:key:HISTCONTROL->value:ignoredups
env:key:HISTSIZE->value:1000
env:key:JAVA_HOME->value:/usr/local/jdk
env:key:TERM->value:xterm
env:key:LANG->value:en_US.UTF-8
env:key:SELINUX_LEVEL_REQUESTED->value:
env:key:SELINUX_ROLE_REQUESTED->value:
env:key:TMOUT->value:0
env:key:UDF->value:TEST_UDF_VAL
env:key:NSS_SDB_USE_CACHE->value:yes
env:key:_->value:/bin/java
env:key:UDF_ENV_KEY->value:ENV_VAL
env:key:LESSOPEN->value:||/usr/bin/lesspipe.sh %s
env:key:SHELL->value:/bin/sh
env:key:QT_GRAPHICSSYSTEM_CHECKED->value:1
env:key:SELINUX_USE_CURRENT_RANGE->value:
env:key:FLINK_HOME->value:/home/dcstreampark/env/flink
env:key:QTINC->value:/usr/lib64/qt-3.3/include
env:key:SSH_TTY->value:/dev/pts/2
env:key:SSH_CLIENT->value:10.80.23.112 60907 22
env:key:CLASSPATH->value:.:/usr/local/jdk/lib/tools.jar:/usr/local/jdk/lib/dt.jar:/usr/local/jdk/lib
env:key:QTDIR->value:/usr/lib64/qt-3.3
env:key:QTLIB->value:/usr/lib64/qt-3.3/lib
env:key:SHLVL->value:1
prop:key:sun.cpu.isalist->value:
prop:key:sun.io.unicode.encoding->value:UnicodeLittle
prop:key:sun.cpu.endian->value:little
prop:key:java.vendor.url.bug->value:https://bugzilla.redhat.com/enter_bug.cgi?product=Red%20Hat%20Enterprise%20Linux%207&component=java-1.8.0-openjdk
prop:key:file.separator->value:/
prop:key:java.vendor->value:Red Hat, Inc.
prop:key:sun.boot.class.path->value:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre/lib/resources.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre/lib/rt.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre/lib/jsse.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre/lib/jce.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre/lib/charsets.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre/lib/jfr.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre/classes
prop:key:java.ext.dirs->value:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre/lib/ext:/usr/java/packages/lib/ext
prop:key:java.version->value:1.8.0_292
prop:key:java.vm.info->value:mixed mode
prop:key:awt.toolkit->value:sun.awt.X11.XToolkit
prop:key:user.language->value:en
prop:key:java.specification.vendor->value:Oracle Corporation
prop:key:sun.java.command->value:flink-config-1.0.jar
prop:key:java.home->value:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre
prop:key:sun.arch.data.model->value:64
prop:key:java.vm.specification.version->value:1.8
prop:key:java.class.path->value:flink-config-1.0.jar
prop:key:file.encoding->value:UTF-8
prop:key:java.specification.version->value:1.8
prop:key:java.awt.printerjob->value:sun.print.PSPrinterJob
prop:key:user.timezone->value:
prop:key:os.version->value:5.10.38-21.01.el7.x86_64
prop:key:sun.management.compiler->value:HotSpot 64-Bit Tiered Compilers
prop:key:java.specification.name->value:Java Platform API Specification
prop:key:java.class.version->value:52.0
prop:key:java.library.path->value:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
prop:key:sun.jnu.encoding->value:UTF-8
prop:key:os.name->value:Linux
prop:key:java.vm.specification.vendor->value:Oracle Corporation
prop:key:java.io.tmpdir->value:/tmp
prop:key:line.separator->value:prop:key:java.endorsed.dirs->value:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre/lib/endorsed
prop:key:os.arch->value:amd64
prop:key:java.awt.graphicsenv->value:sun.awt.X11GraphicsEnvironment
prop:key:java.runtime.version->value:1.8.0_292-b10
prop:key:java.vm.specification.name->value:Java Virtual Machine Specification
prop:key:user.country->value:US
prop:key:sun.java.launcher->value:SUN_STANDARD
prop:key:sun.os.patch.level->value:unknown
prop:key:java.vm.name->value:OpenJDK 64-Bit Server VM
prop:key:file.encoding.pkg->value:sun.io
prop:key:path.separator->value::
prop:key:java.vm.vendor->value:Red Hat, Inc.
prop:key:java.vendor.url->value:https://www.redhat.com/
prop:key:sun.boot.library.path->value:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre/lib/amd64
prop:key:java.vm.version->value:25.292-b10
prop:key:java.runtime.name->value:OpenJDK Runtime Environment
(1)System.getEnv()
获取的都是,系统环境变量
比如:
export JAVA_HOME=usr/jdk-1.8
(2)System.getProperty()
获取的都是java环境变量,可以通过System.setProperty()
设置
参考文章:
系统变量之System.getenv和System.getProperty()
linux环境变量和linux命令export