开发者

Can I open a file in Java that is in a user's home directory on Windows Enterprise with Active Directory?

开发者 https://www.devze.com 2023-03-27 03:24 出处:网络
I have a program that puts some information in a user\'s My Documents folder.I find this folder by using System.getProperty(\"user.home\");Now I have a customer for whom this doesn\'t work and when I

I have a program that puts some information in a user's My Documents folder. I find this folder by using System.getProperty("user.home"); Now I have a customer for whom this doesn't work and when I got some debug output from him the file name it tried to access was in the form \name.com\HHA\Users\person\My开发者_运维百科 Documents\file.txt. Is this related to active directory? Or some other weirdness?


try using JfileChooser

new JFileChooser().getFileSystemView().getDefaultDirectory(); 

instead of

System.getProperty("user.home");

i doubt it returns proper home directory


ok then please try this..

Runtime.getRuntime().exec("explorer.exe C:\\Documents and Settings\\All Users\\Documents");

Do notice double back slash and take care while using code..!! and ya you can change the path as per your config.!!

Thanks.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号