Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/388.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法读取jar文件中的图像:javafx_Java_Eclipse_Javafx_Jar - Fatal编程技术网

无法读取jar文件中的图像:javafx

无法读取jar文件中的图像:javafx,java,eclipse,javafx,jar,Java,Eclipse,Javafx,Jar,当我构建一个jar文件并运行它时,我看不到图像。 在Eclipse中,它工作得很好 图像应该是一个按钮 <effect> <ImageInput> <source> <Image url="file:./images/record_by_felickzs.PNG" /> </source> </ImageInput> </effect> 这是因为在

当我构建一个jar文件并运行它时,我看不到图像。 在Eclipse中,它工作得很好

图像应该是一个按钮

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

这是因为在eclipse上,映像未打包,因此可以通过您的方式访问,但是,当您导出jar文件时,映像已打包,您无法通过这种方式访问jar中的文件,,,请使用相对路径:

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


编辑:用PNG替换PNG

谢谢你的快速回答,但我仍然有同样的问题。请尝试用.PNG替换.PNG。这没有什么区别,然后我们必须检查jar文件的内容