java中如何獲取相關參數(shù)
更新時間:2015年07月21日 11:22:57 作者:uiuasdin
這篇文章主要介紹了java獲取系統(tǒng)屬性相關參數(shù)的方法,,需要的朋友可以參考下
此文通過一段代碼來展示java獲取相關參數(shù)的方法分享給大家:
public static void main(String[] args) {
Properties props=System.getProperties(); //系統(tǒng)屬性
System.out.println("Java的運行環(huán)境版本:"+props.getProperty("java.version"));
System.out.println("Java的運行環(huán)境供應商:"+props.getProperty("java.vendor"));
System.out.println("Java供應商的URL:"+props.getProperty("java.vendor.url"));
System.out.println("Java的安裝路徑:"+props.getProperty("java.home"));
System.out.println("Java的虛擬機規(guī)范版本:"+props.getProperty("java.vm.specification.version"));
System.out.println("Java的虛擬機規(guī)范供應商:"+props.getProperty("java.vm.specification.vendor"));
System.out.println("Java的虛擬機規(guī)范名稱:"+props.getProperty("java.vm.specification.name"));
System.out.println("Java的虛擬機實現(xiàn)版本:"+props.getProperty("java.vm.version"));
System.out.println("Java的虛擬機實現(xiàn)供應商:"+props.getProperty("java.vm.vendor"));
System.out.println("Java的虛擬機實現(xiàn)名稱:"+props.getProperty("java.vm.name"));
System.out.println("Java運行時環(huán)境規(guī)范版本:"+props.getProperty("java.specification.version"));
System.out.println("Java運行時環(huán)境規(guī)范供應商:"+props.getProperty("java.specification.vender"));
System.out.println("Java運行時環(huán)境規(guī)范名稱:"+props.getProperty("java.specification.name"));
System.out.println("Java的類格式版本號:"+props.getProperty("java.class.version"));
System.out.println("Java的類路徑:"+props.getProperty("java.class.path"));
System.out.println("加載庫時搜索的路徑列表:"+props.getProperty("java.library.path"));
System.out.println("默認的臨時文件路徑:"+props.getProperty("java.io.tmpdir"));
System.out.println("一個或多個擴展目錄的路徑:"+props.getProperty("java.ext.dirs"));
System.out.println("操作系統(tǒng)的名稱:"+props.getProperty("os.name"));
System.out.println("操作系統(tǒng)的構架:"+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("用戶的當前工作目錄:"+props.getProperty("user.dir"));
}
希望大家能夠喜歡。
相關文章
Java?SE判斷兩個文件內(nèi)容是否相同的多種方法代碼
昨天因為要幫師兄的忙所以看了一下如何判斷兩個文件內(nèi)容是否相同,這里給大家總結下,這篇文章主要給大家介紹了關于Java?SE判斷兩個文件內(nèi)容是否相同的多種方法,需要的朋友可以參考下2023-11-11
springboot2.3 整合mybatis-plus 高級功能(圖文詳解)
這篇文章主要介紹了springboot2.3 整合mybatis-plus 高級功能,本文通過圖文并茂的形式給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-08-08
Java中實現(xiàn)高清圖片壓縮的兩種方案(最新推薦)
文章首先介紹了Java中進行高清圖片壓縮的基本方法,包括使用Java標準庫ImageIO和第三方庫ApacheCommonsCompress,通過示例代碼展示了如何調(diào)整圖像質(zhì)量和使用第三方工具來壓縮圖片文件,感興趣的朋友跟隨小編一起看看吧2025-01-01
mybatis參數(shù)String與Integer類型的判斷方式
這篇文章主要介紹了mybatis參數(shù)String與Integer類型的判斷方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-03-03
Spring實戰(zhàn)之FileSystemResource加載資源文件示例
這篇文章主要介紹了Spring實戰(zhàn)之FileSystemResource加載資源文件,結合實例形式分析了spring FileSystemResource加載xml資源文件的具體實現(xiàn)步驟與相關操作技巧,需要的朋友可以參考下2019-12-12

