【问题标题】:JavaFX Builder 1.0 unable to open a fileJavaFX Builder 1.0 无法打开文件
【发布时间】:2013-06-16 19:30:21
【问题描述】:

当我尝试从 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 builder 会抱怨?是因为图像在应用程序中吗?

如果我这样做-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
  ..

【问题讨论】:

  • 感谢您的提示。我是stackoverflow的新手。我已经编辑了我的帖子以显示我在执行-tvf tra.jar 时得到的结果。有帮助吗?
  • 确实如此。你能在你身边复制它吗?
  • 我已通过将图像 url 更改为 @../src/misc/image1.jpg 来修复它
  • 很高兴你把它整理好了。 :) 你应该输入它作为答案。
  • 感谢您的帮助:)

标签: java image javafx fxml


【解决方案1】:

通过将 url 更改为 @../src/misc/image1.jpg 来修复

【讨论】:

    猜你喜欢
    • 2016-07-27
    • 2014-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-14
    • 1970-01-01
    • 2019-01-06
    • 1970-01-01
    相关资源
    最近更新 更多