获取当前绝对路径

获取当前绝对路径

    这个也是以前写的一点东西,今天要用,又扒出来了。希望能给大家带来帮助:

 1 
 2  public   class  GetPath {
 3       public   static   void  main(String[] args) {
 4          GetPath test  =   new  GetPath();
 5          System.out.println(test.getPath());
 6      }
 7      
 8       public  String getPath() {
 9           return   this .getClass().getResource( " / " ).getPath();
10      }
11  }
12 

你可能感兴趣的:(获取当前绝对路径)