路径整理

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;

你可能感兴趣的:(java,thread,jsp)