0

Its the second time i use ui4j, so i am not sure if i have done something wrong. i want to read a website so i have:

public static void main(String[] args) throws InterruptedException {
    BrowserEngine webkit = BrowserFactory.getWebKit();

    // load the page
    Page page = webkit.navigate("http://www.okaa.gr/en/news-and-announcements/");
    page.show();

    // get the page
    Document document = page.getDocument();
}

This for some reason gives me this error:

java.lang.NullPointerException at

com.sun.javafx.Utils.getScreen(Unknown Source) at

com.sun.javafx.webkit.WebPageClientImpl.getScreenBounds(Unknown Source) at com.sun.webkit.WCWidget.fwkGetScreenRect(Unknown Source) at com.sun.webkit.Timer.twkFireTimerEvent(Native Method) at com.sun.webkit.Timer.fireTimerEvent(Unknown Source) at com.sun.webkit.Timer.notifyTick(Unknown Source) at javafx.scene.web.WebEngine$PulseTimer.lambda$static$45(Unknown Source) at javafx.scene.web.WebEngine$PulseTimer$$Lambda$73/4280098.pulse(Unknown Source) at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Unknown Source) at com.sun.javafx.tk.Toolkit$$Lambda$105/18919485.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.tk.Toolkit.runPulse(Unknown Source) at com.sun.javafx.tk.Toolkit.firePulse(Unknown Source) at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(Unknown Source) at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(Unknown Source) at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$400(Unknown Source) at com.sun.javafx.tk.quantum.QuantumToolkit$$Lambda$43/10413918.run(Unknown Source) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$145(Unknown Source) at com.sun.glass.ui.win.WinApplication$$Lambda$39/30515573.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

The same code with a different url works just fine. I executed the ui4j ide and it loads the site ok. but still i cant get it to work on eclipse.

Skaros Ilias
  • 1,008
  • 12
  • 40
  • I assume this erros occurs, when you try to load a new URL but the WebView is not visible. – Ben May 11 '15 at 07:06
  • @ben honestly i have no recollection about this problem!!!! i either changed my system with out using ui4J, or i found some solution for it, but really I cant remember what i did. its been more than a month and since then i had sooooo many problems that i lost count:) thanks for your interest. – Skaros Ilias May 12 '15 at 21:51

0 Answers0