Can I open a file in Java that is in a user's home directory on Windows Enterprise with Active Directory?
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.
精彩评论