我想要一个项目,在我的 jar 文件旁边有一些文件夹:
+- MyProject.jar
+- graphics
+- image1.jpg
+- image2.jpg
+- paper.jpg
+- plugins
+- plugin1.jar
+- plugin2.jar
+- plugin3.jar
在MyProject.jar
我有这条线:
URL loc = this.getClass().getResource("/../graphics/paper.jpg");
这是触发此错误:
Exception in thread "Timer-0" java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(ImageIO.java:1388)
at fotofilter.filters.Blueprint.getPaper(Blueprint.java:116)
at fotofilter.filters.Blueprint.filter(Blueprint.java:45)
at fotofilter.FotoFilter.blueprint(FotoFilter.java:103)
at fotofilter.FotoFilter$1.run(FotoFilter.java:55)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
我使用得当吗?