At the moment Nashorn API (http://download.java.net/jdk8/docs/technotes/guides/scripting/nashorn/api.html) is not available in a WebView. A try to run this:
System.out.println(browser.getEngine().executeScript("Java.type(\"java.lang.Math\").PI"));
Would lead to JSException:
netscape.javascript.JSException: ReferenceError: Can't find variable: Java
at com.sun.webkit.dom.JSObject.fwkMakeException(JSObject.java:128)
at com.sun.webkit.WebPage.twkExecuteScript(Native Method)
at com.sun.webkit.WebPage.executeScript(WebPage.java:1410)
at javafx.scene.web.WebEngine.executeScript(WebEngine.java:934)
Adding Nashorn API would simplify running Java code in a WebView and make easier the development of desktop applications using JavaScript frameworks like AngularJS, Twitter Bootstrap, PhoneGap, etc. Though it is possible at the moment, it requires adding boilerplate code and JavaScript-to-Java call workarounds, i.e. serializing complex objects to JSON.