`

路径整理

    博客分类:
  • path
阅读更多

java   aplication:    
  System.getProperty("user.dir");//获得当前执行目录  
  Test   t   =   new   Test();  
  t.getClass().getResource("/");   //或得当前程序所在目录  
   
  jsp:  
  application.getRealPath("/");//当前文件所在目录  
  System.getProperty("user.dir");//获得当前执行目录 
1.URL url =Thread.currentThread().getContextClassLoar().getResource("");
可以得到类运行目录。
2.System.getProperties().get("java.class.path"),可以得到当前运行程序的classpath;

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics