如何使用Java提取路径“c:/documents and settings/user”...有什么方法吗?
最佳答案
System.getProperty("user.home")
应该够了。请参阅here举个例子。
public class UserHomeExample
{
public static void main(String[] args)
{
System.out.println("User Home Path: "+ System.getProperty("user.home"));
}
}
给予:
C:\convert\rajesh\completed>javac UserHomeExample.java
C:\convert\rajesh\completed>java UserHomeExample
User Home Path: C:\Documents and Settings\Administrator
关于java - 如何使用 Java 获取特殊系统目录的路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1672109/