众所周知,第一次查看class文件时,eclipse会给个界面选择添加源代码路径。

但是,如果我要换源代码路径了怎么办,eclipse也不会提示了。那就使用手动的吧
方法1:
使用eclipse添加一个编译路径,适用于源代码已经导入到eclipse中变为工程的情况。点击add按钮,选源代码工程天津爱就好了。注意:如果你Libraries有源代码工程的jar包的话,可以去掉。

.png)
方法2:
直接修改工程的.classpath文件
classpath文件中配置本身是没有sourcepath属性的,当第一次为工程指定源代码路径的时候,eclipse实现方法实际上就是修改了classpath文件,添加的就是这个sourcepath属性。呵呵,知道原理,就知道怎么做了吧

.png)