System.out.println(System.getProperty("java.class.path"));//系统的classpaht路径
System.out.println(System.getProperty("user.dir"));//用户的当前路径
System.out.println(System.getProperty("user.dir"));//用户的当前路径
本文介绍了如何使用Java代码打印出当前运行时的类路径(classpaht)和用户工作目录。通过调用System.getProperty方法并传入特定参数,可以轻松地获取这两个路径。
5653
1125

被折叠的 条评论
为什么被折叠?