星期日, 十一月 26, 2006

java中如何获得操作系统下用户目录

String usrHome = System.getProperty("user.home");

下面是System的参数列表

Key Meaning
------------------- ------------------------------
"file.separator" File separator (e.g., "/")
"java.class.path" Java classpath
"java.class.version" Java class version number
"java.home" Java installation directory
"java.vendor" Java vendor-specific string
"java.vendor.url" Java vendor URL
"java.version" Java version number
"line.separator" Line separator
"os.arch" Operating system architecture
"os.name" Operating system name
"path.separator" Path separator (e.g., ":")
"user.dir" User's current working directory
"user.home" User home directory
"user.name" User account name

没有评论: