Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8089751

WebEngine cannot load an svg file located in a jar file: URL

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8
    • Fix Version/s: tbd
    • Component/s: javafx
    • Environment:

      Windows 7, Java 8 u 128 32bits, NetBeans 7.4

    • Subcomponent:
      web

      Description

      When using the WebEngine object to load an svg file url located in a jar it does not display in a WebView node.

      To reproduce:
      When creating a NetBeans JavaFX applicaton project replace the hello world code inside the start() method with the following:
            WebView browser = new WebView();
            URL url = getClass().getResource("clock.svg"); // doesn't work
            //URL url = getClass().getResource("clock.html"); // works
            browser.getEngine().load(url.toExternalForm());
            System.out.println("" + url.toExternalForm());
            Scene scene = new Scene(browser,320,250, Color.rgb(0, 0, 0, .80));
            primaryStage.setScene(scene);
            primaryStage.show();

      Assuming you have a valid SVG file the application tries to load from the following location:
      jar:file:/C:/Users/cdea/jfx8ibe/DisplayingHtml5Content/dist/run562867542/DisplayingHtml5Content.jar!/jfx8ibe/clock.svg


      Work around:
      Now the funny thing is, if I have an identical file called 'clock.html' it works fine.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              cdea Carl Dea
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported: