我需要在java中添加用戶配置文件變量,顯然%userprofile%不起作用。當我嘗試將它輸入到代碼底部的目錄中時,它不接受它。但是我可以在命令行中回顯我的%userprofil%如何正常添加userprofile變量%userprofile%
userprofile +「\ Downloads \ file.txt」);
我需要在java中添加用戶配置文件變量,顯然%userprofile%不起作用。當我嘗試將它輸入到代碼底部的目錄中時,它不接受它。但是我可以在命令行中回顯我的%userprofil%如何正常添加userprofile變量%userprofile%
userprofile +「\ Downloads \ file.txt」);
String System.getenv(String var)
所以
String userprofile = System.getenv("USERPROFILE");
然後操縱作爲defired(如附加的路徑的其餘部分...)
另外,獲得與Map<String,String> System.getenv()
我到底會如何實現這一目標? – jerhynsoen
明白了! static String userprofile = System.getenv(「USERPROFILE」); – jerhynsoen
你想要做什麼.. – Ahmad