`

system properties和environment properties

阅读更多
原来我一直都混淆了system properties和environment properties。今天终于搞清楚了,记录一下

一、system properties

这里的system指的不是OS,而是JVM system

system properties通过
System.getProperty(key);

来获取

而设置的方法主要有3种:

第一种是JVM内置的,包括java.vm.version等,通过以下代码可以看到全集
Properties props = System.getProperties();
		
		Set<Object> keys = props.keySet();
		
		for(Object key:keys){
			System.out.println(key);
		}

第二种是在启动时,通过-D参数设置的

第三种则是通过
System.setProperty(key, value);

来设置

二、environment properties

这里的environment指的才是操作系统

获取这种参数的方法是
System.getenv();

在操作系统里设置的环境变量,可以通过这个方法取到

通过以下代码,可以取到全集
Map<String, String> env = System.getenv();

		Set<String> keys = env.keySet();

		for (String key : keys) {
			System.out.println(key);
		}
分享到:
评论

相关推荐

    Some properties of the Logistic map over the finite field and its application

    The Logistic map is a classical chaotic system and has been used as a chaotic cipher in the real number field. This inevitably leads to the degradation of finite precision under the computer ...

    java 环境配置(2024超全教程)-学习Android第一步就是配置Java的开发环境-供大家学习研究参考

    安装完JDK以后,需要配置Java的系统的全局变量。一共需要加三个: JAVA_HOME:JDK的安装路径 Path:JAVA的二进制文件路径,就是JDK的安装...在System Properties的Advanced选项卡里,点击Environment Variables按键。

    robotic system motion in simMechanics and MATLAB GUI.pdf

    Analysis of Robotic System Motion in SimMechanics and MATLAB GUI Environment。 Robots present considerably complicated electromechanical systems with mutual interactions of robot mechanics and ...

    spring-properties-decrypter:透明解密将在Spring环境中使用的属性值

    弹簧属性解密器 使用库透明地解密要在Spring环境中使用的属性值。 如何使用 Gradle依赖 runtime('eu.hinsch:...在可以定义的任何地方定义任何spring环境属性(application * .properties / yaml,system,environment

    linuxdeploy-2.1.0-237.apk

    Applications of the new system are run in a chroot environment and working together with the Android platform. All changes made on the device are reversible, i.e. the application and components can ...

    matlab提取文件要素代码-Python_Scraper:Python代码,Jupyter笔记本,Scrapy和Tkinter

    %yourusername%和System variables 2.4.1-单击Path 2.4.2-单击New 2.4.3-添加以下路径 C:\Users\%yourusername%\AppData\Local\Programs\Python\Python37 C:\Users\%yourusername%\AppData\Local\Programs\Python\...

    Android代码-konf

    Support sources from JSON, XML, YAML, HOCON, TOML, properties, map, command line and system environment out of box. Cascading. Config can fork from another config by adding a new layer on it. Each ...

    USENIX Association Proceedings of MobiSys 2003

    networked environment. A service-oriented network socket takes a high-level description of a service and opportunistically connects to the best provider of that service in the changing characteristics...

    Devart LinqConnect 3.1

    LinqConnect is a fast and easy-to-use ORM solution, developed ...The behaviour is changed: the TINYINT(1) data type is now used for the columns which correspond to the System.Boolean properties (MySQL)

    Natural Image Statistics

    A theoretical framework which is gaining more and more support considers the properties of the visual system to be reflections of the statistical structure of natural images because of evolutionary ...

    Lesson-2-master.zip

    1. Summarize the DXE phase and its purpose, functions, properties, attributes, and components * Identify the responsibilities of the DXE phase 2. Describe events and their role in the DXE phase 3. ...

    自然图像统计:一种早期计算机视觉的概率方法(英文原版)

    and more support considers the properties of the visual system to be reflections of the statistical structure of natural images because of evolutionary adaptation processes. Another motivation for ...

    [PLDI07]Online Optimizations Driven by Hardware Performance

    captures general program properties (like execution frequency of methods or basic blocks) may be useful, but does not capture sufficient information about the execution platform. Machine-level ...

    p12-stoica.pdf

    Chord protocol and proves several of its properties, while Section 5 presents extensions to handle concurrent joins and failures. Sec- tion 6 demonstrates our claims about Chord’s performance ...

    vb.net 文本浏览FolderBrowserDialog使用方法

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Set the FolderBrowser dialog properties With (FolderBrowserDialog1) .Description = ...

    DWGdirectX2.7.3

    System Requirements Supported Operating Systems: Windows 2000, Windows XP, Windows Vista Supported Languages: VB, C#, C++, other COM-accessible languages Documentation Documentation for ...

    VB.NET Developer's Guide(4574).pdf

    System Namespace 153 File I/O 155 Drawing 156 Printing 157 Common Type System 158 Type Casting 160 Garbage Collection 163 Object Allocation/Deallocation 164 Close/Dispose 165 Summary 166 ...

    Linux System Administrator Guide Version0.9

    Linux System Administrator Guide Version0.9 &lt;br&gt;Table of Contents About This Book....................................................................................................................

    Canvas袖珍参考手册(第1版)

    Canvas Pocket Reference provides both a tutorial that covers all of the element's features with plenty of examples and a definitive reference to each of the Canvas-related ... and properties....

Global site tag (gtag.js) - Google Analytics