将maven项目构建到jar之后,我得到FileNotFoundException。我知道,资源文件都在根目录下的项目被从而建立后,我用它来得到我的文件:构建jar之后的Maven资源文件
final File file = new File("maps/ParcelsCountyRDMFinal5.shp");
这里是个例外:
C:\Users\ilija\Desktop\MavenizedCP\cp-map\target>java -jar cp-map-0.0.1-SNAPSHOT
-shaded.jar
Exception in thread "main" java.io.FileNotFoundException: C:\Users\ilija\Desktop
\MavenizedCP\cp-map\target\maps\ParcelsCountyRDMFinal5.shp (The system cannot fi
nd the path specified)
这里的工作目录,显然是目录从中我想运行jar。我想工作目录应该是jar的根目录。
请帮助这里。我究竟做错了什么?
究竟哪里是你的ParcelsCountyRDMFinal5.shp文件?它是在C:\ maps \ ParcelsCountyRDMFinal5.shp还是它在资源目录中的maven项目的一部分? – eigil 2012-02-15 19:44:06
它是我的maven项目资源目录的一部分! – ilija 2012-02-15 19:49:40