JavaFX 8 WebEngine: How to get console.log() from javascript to System.out in java?
问题 I\'m using both JavaFX and the javascript engine inside JavaFX WebEngine to develop an application. I\'d like to get feedback from javascript for debugging purposes. What happens to the console output inside the WebEngine? Is there any way I can access it, or redirect to System.out in java? 回答1: The following code redirects console.log() to JavaBridge.log() : import netscape.javascript.JSObject; [...] public class JavaBridge { public void log(String text) { System.out.println(text); } } //