java获取项目路径

System.getProperty("user.dir") : E:\workspace\lucene
class.getResource("") : /E:/workspace/lucene/target/test-classes/com/hbzx/lucene/
class.getResource("/") : /E:/workspace/lucene/target/test-classes/
class.getResource(".") : /E:/workspace/lucene/target/test-classes/com/hbzx/lucene/
new File("").getAbsolutePath() : E:\workspace\lucene
new File("/").getAbsolutePath(): E:\


你可能感兴趣的:(java获取项目路径)