eclipse新建的项目,读取项目中的文件??

如图所示,新建了一个java project,在src文件下新建了两个package,
一个package下是主函数,另外一个package下新建了一个txt文档。
跟src同级目录新建了一个source文件夹,文件夹下新建了一个txt文档,现在想分别读取项目中的这两个txt文档,test.java中代码应该怎么获取到这两个文件路径?不要那种C:\user\ ..........之类的路径

图片说明

String strdir = System.getProperty("user.dir") + "\source";
这个到目录下了

String path = test.class.getResource("/").getPath() 这个会返回当前项目的根目录 然后你再 加上 path = path + “source"

把你的source设置为根路径就是 图片说明

直接用相对路径啊
String path1 = "source/test.txt";
String path2 = "src/com/project02/test02/test02.txt";
InputStream inputStream = new InputStream(new File(path1));
//InputStream inputStream = new InputStream(new File(path2));