Skip to main content

Java FX Container for web app

Please note these forums are being decommissioned and use the new and improved forums at
2 replies [Last post]
Joined: 2014-01-18

Hi, I am trying to develop a container in javaFX as a WevView to display a web app, in the NetBeans IDE
I am trying to display hola.html inside the container, which is in the same directory as the jar file, so theorically there wouldn't be any kind of problem on displaying it inside the container, but all I get is a blank page that does nothing.
Is there any javascript or html javaFX doesn't display correctly?
Perhaps because of the resolution of the window is smaller than the resolution of the html page, that it doesn't show it?
Is there any way to change Netbeans project execution so it doesn't create an temporary directory and places the jar there so the path would fit?
Is the WebView for online pages only and does not display local ones?
I am using Linux Mint last version, also java JRE last version

package contenedor;

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

public class Contenedor extends Application
public static void main(String[] args)
public void start(Stage primaryStage) throws Exception

WebView browser = new WebView();
WebEngine engine = browser.getEngine();
String url = "hola.html";

StackPane sp = new StackPane();

Scene root = new Scene(sp);


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2014-01-18


Joined: 2012-06-03

your code seems to be ok. Just to be sure, try to use the absolute path's URL from a file, like this:

File f = new File("Path to file");
String URL = f.toURI.toURL.toString();


When the Engine don't find the page to open, it simply does nothing, which explain your blank screen.

You gotta google more about these issues, there are plenty of examples.