2017-07-17 99 views
0

当我构建一个jar文件运行它时,我看不到图像。在Eclipse中它工作得很好。无法读取jar文件中的图像:javafx

的形象应该是一个按钮

<effect> 
    <ImageInput> 
     <source> 
      <Image url="file:./images/record_by_felickzs.PNG" /> 
     </source> 
    </ImageInput> 
</effect> 

回答

0

,这是因为在Eclipse上的图像中不被打包所以它是可以访问你正在做的方式,但是当您导出一个JAR文件的图像,包装和你不能访问罐子这样的内部文件,,,使用而不是相对路径:

<effect> 
    <ImageInput> 
     <source> 
      <Image url="@../../images/record_by_felickzs.PNG" /> 
     </source> 
    </ImageInput> 
</effect> 

编辑:以PNG代替PNG

+0

感谢您快速的答案,但我仍然有同样的问题 – dreas

+0

尝试.png代替.PNG请 –

+0

这个没有什么不同 – dreas