当我尝试从 Netbeans 打开 .fxml 文件时,出现以下错误:
StaffRota.fxml:101: error:
java.lang.IllegalArgumentException: Invalid URL or resource not found
我在该 xml 中的代码是:
<ImageView id="image1.jpg" layoutX="150.0" layoutY="18.0">
<image>
<Image url="/theatre/room/allocation/src/misc/image1.jpg" preserveRatio="true" smooth="true" />
</image>
</ImageView>`
我的 java 应用程序构建和部署良好(并正确渲染图像)。为什么 JavaFX 构建器会提示?是因为图像在应用程序内吗?
如果我执行-tvf tra.jar
,我会得到以下结果:-
C:\Users\..\Documents>jar -tvf tra.jar
0 Mon Jun 17 19:54:26 BST 2013 META-INF/
425 Mon Jun 17 19:54:26 BST 2013 META-INF/MANIFEST.MF
0 Mon Jun 17 19:54:26 BST 2013 theatre/
0 Mon Jun 17 19:54:26 BST 2013 theatre/room/
0 Mon Jun 17 19:54:26 BST 2013 theatre/room/allocation/
..
2563 Mon Jun 17 19:54:26 BST 2013 theatre/room/allocation/src/misc/image1.jpg
..
最佳答案
通过将网址更改为@../src/misc/image1.jpg
来修复
关于JavaFX Builder 1.0 无法打开文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17136904/