JDK-8136529 : WebView dont load additional files included in html files when files are in jar
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 8u60
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2015-09-14
  • Updated: 2016-06-02
  • Resolved: 2016-06-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]

A DESCRIPTION OF THE PROBLEM :
When application load html file from the jar, and html file contains links to other files in the jar (like css or javascripts), that other files are not loaded. 

This was working fine in previous Jave versions.

REGRESSION.  Last worked in version 8u51

ADDITIONAL REGRESSION INFORMATION: 
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
WebViewTest .java

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

public class WebViewTest extends Application {
    
    @Override
    public void start(Stage primaryStage) {
    
        WebView browser = new WebView();
        WebEngine engine = browser.getEngine();
        engine.load(this.getClass().getResource("/index.html").toExternalForm());
        final Scene scene = new Scene(browser, 800, 650);

        primaryStage.setScene(scene);
        primaryStage.show();            
    
    }


index.html

<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" href="main.css" />
    </head>
    <body>
        <div class="test">TEST CSS</div>
    </body>
</html>


main.css

.test {
    color: red;
}



---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Move other resources to external location. 



Comments
Fixed as part of JDK-8136466 http://hg.openjdk.java.net/openjfx/9-dev/rt/rev/d4f8c9496683
14-10-2015

CSS resource file not loaded when its included in the jar file
22-09-2015

This might be a CSS issue in which case it should be reassigned to controls.
17-09-2015