1

I get the following error when I try to open a .fxml file from Netbeans:

StaffRota.fxml:101: error: 
  java.lang.IllegalArgumentException: Invalid URL or resource not found

the code I have in that xml is:

<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>`

My java application builds and deploys fine (and renders the image correctly). Why would JavaFX builder complain? Is it because the image is within the application?

Here's what I get if I do -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
  ..
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
obsessiveCookie
  • 1,130
  • 2
  • 18
  • 33

1 Answers1

1

Fixed by changing the url to @../src/misc/image1.jpg

obsessiveCookie
  • 1,130
  • 2
  • 18
  • 33