java获取系统属性_Java获取系统属性
1、System類
The System class contains several useful class fields and methods. It cannot be instantiated.
Among the facilities provided by the System class are standard input, standard output, and error output streams; access to externally defined properties and environment variables; a means of loading files and libraries; and a utility method for quickly copying a portion of an array.
大意是:System類中包含了一些有用的字段和方法,它不能被實(shí)例化。System類中提供了一些基礎(chǔ)的功能,它們是標(biāo)準(zhǔn)輸入流、輸出流、錯(cuò)誤流;訪問(wèn)外部定義的屬性和環(huán)境變量;加載文件和類庫(kù)的一種方式;以及一個(gè)有用的快速?gòu)?fù)制數(shù)組中的部分內(nèi)容的方法。
2、環(huán)境變量和系統(tǒng)屬性
(1)環(huán)境變量是指系統(tǒng)環(huán)境變量,系統(tǒng)屬性是指當(dāng)前JVM專用的,它可能與環(huán)境變量有交集,但不會(huì)完全相同。
(2)獲取環(huán)境變量用getenv()方法
public staticMapgetenv()
獲取系統(tǒng)屬性用getProperties()方法
public static PropertiesgetProperties()
(3)JVM在啟動(dòng)的時(shí)候,會(huì)將環(huán)境變量裝換到系統(tǒng)屬性里面??梢栽趖omcat的bin目錄下的catalina.bat文件中發(fā)現(xiàn)一些預(yù)定義的必須的環(huán)境變量
與50位技術(shù)專家面對(duì)面20年技術(shù)見(jiàn)證,附贈(zèng)技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的java获取系统属性_Java获取系统属性的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: java链式结构_(Java)单链表Ja
- 下一篇: python边缘检测代码_Python中