第一种: File f = new File(this.getClass().getResource("/").getPath()); System.out.println(f); 结果: C:\Documents%20and%20Settings\Administrator\workspace\projectName\bin 获取当前类的所在工程路径; 如果不加“/” File f = new File(this.getClass().getResource(""
public class Test { public void run() { // TODO Auto-generated method stub System.out.println("测试========>"); String s1=this.getClass().getResource("").getPath(); String s2=this.getClass().getResource("/").getPath(); Syste