java中關(guān)于getProperties方法的使用
關(guān)于getProperties方法的使用
public static void main(String[] args) {
Properties props = System.getProperties();
System.out.println("Java的運(yùn)行環(huán)境版本:"+props.getProperty("java.version"));
System.out.println("Java的運(yùn)行環(huán)境供應(yīng)商:"+props.getProperty("java.vendor"));
System.out.println("Java的運(yùn)行環(huán)境供應(yīng)商URL:"+props.getProperty("java.vendor.url"));
System.out.println("Java的安裝路徑:"+props.getProperty("java.home"));
System.out.println("Java的虛擬機(jī)規(guī)范名稱:"+props.getProperty("java.vm.specification.name"));
System.out.println("Java的虛擬機(jī)實(shí)現(xiàn)版本:"+props.getProperty("java.vm.version"));
System.out.println("Java的虛擬機(jī)實(shí)現(xiàn)供應(yīng)商:"+props.getProperty("java.vm.vendor"));
System.out.println("Java的虛擬機(jī)實(shí)現(xiàn)名稱:"+props.getProperty("java.vm.name"));
System.out.println("Java的類格式版本號(hào):"+props.getProperty("java.class.version"));
System.out.println("Java的類路徑:"+props.getProperty("java.class.path"));
System.out.println("加載庫時(shí)搜索的路徑列表:"+props.getProperty("java.library.path"));
System.out.println("默認(rèn)的臨時(shí)文件路徑:"+props.getProperty("java.io.tmpdir"));
System.out.println("一個(gè)或多個(gè)擴(kuò)展目錄的路徑:"+props.getProperty("java.ext.dirs"));
System.out.println("操作系統(tǒng)的名稱:"+props.getProperty("os.name"));
System.out.println("操作系統(tǒng)的構(gòu)架:"+props.getProperty("os.arch"));
System.out.println("操作系統(tǒng)的版本:"+props.getProperty("os.version"));
System.out.println("分件分隔符:"+props.getProperty("file.separator"));//在 unix 系統(tǒng)中是"/"
System.out.println("路徑分隔符:"+props.getProperty("path.separator"));//在 unix 系統(tǒng)中是":"
System.out.println("行分隔符:"+props.getProperty("line.separator"));//在 unix 系統(tǒng)中是"/n"
System.out.println("用戶的賬戶名稱:"+props.getProperty("user.name"));
System.out.println("用戶的主目錄:"+props.getProperty("user.home"));
System.out.println("用戶的當(dāng)前工作主目錄:"+props.getProperty("user.dir"));
}
Java System.getProperties()方法
System.getProperty()
ehcache的配置文件中默認(rèn)的臨時(shí)文件路徑是"java.io.tmpdir"
如果需要獲得具體的路徑可以使用java的方法輸出查看
// 查看java.io.tmpdir的路徑, 不同的環(huán)境路徑會(huì)不一樣
System.getProperty("java.io.tmpdir");System.getProperties()
如果需要查看其它屬性可以使用System.getProperties()查看所有的屬性
// 查看System property有哪些 Properties properties = System.getProperties(); System.out.println(properties);
總結(jié)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
Java實(shí)戰(zhàn)之酒店人事管理系統(tǒng)的實(shí)現(xiàn)
這篇文章主要介紹了如何用Java實(shí)現(xiàn)酒店人事管理系統(tǒng),文中采用的技術(shù)有:JSP、Spring、SpringMVC、MyBatis等,感興趣的小伙伴可以學(xué)習(xí)一下2022-03-03
SpringBoot結(jié)合Mybatis實(shí)現(xiàn)創(chuàng)建數(shù)據(jù)庫表的方法
本文主要介紹了SpringBoot結(jié)合Mybatis實(shí)現(xiàn)創(chuàng)建數(shù)據(jù)庫表的方法,文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-01-01
SpringBoot整合mybatis-plus實(shí)現(xiàn)分頁查詢功能
這篇文章主要介紹了SpringBoot整合mybatis-plus實(shí)現(xiàn)分頁查詢功能,pringBoot分頁查詢的兩種寫法,一種是手動(dòng)實(shí)現(xiàn),另一種是使用框架實(shí)現(xiàn),現(xiàn)在我將具體的實(shí)現(xiàn)流程分享一下,需要的朋友可以參考下2023-11-11
詳解MyBatis多數(shù)據(jù)源配置(讀寫分離)
這篇文章主要介紹了詳解MyBatis多數(shù)據(jù)源配置(讀寫分離),小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-01-01
Redis監(jiān)聽過期的key實(shí)現(xiàn)流程詳解
本文主要介紹了Redis監(jiān)聽key的過期時(shí)間,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-02-02
使用JDBC工具類實(shí)現(xiàn)簡(jiǎn)單的登錄管理系統(tǒng)
這篇文章主要為大家詳細(xì)介紹了使用JDBC工具類實(shí)現(xiàn)簡(jiǎn)單的登錄管理系統(tǒng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-02-02
HashMap工作原理_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理
這篇文章主要介紹了HashMap工作原理_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理,需要的朋友可以參考下2017-04-04

