Forum Stats

  • 3,750,225 Users
  • 2,250,135 Discussions
  • 7,866,838 Comments

Discussions

java.awt.Desktop.getDesktop causing java.lang.NullPointerException

Karanbir Dhillon-Oracle
Karanbir Dhillon-Oracle Member Posts: 5
edited Jul 18, 2016 7:00PM in Generics

JRE Version - 1.0.8_91 and Code partial line ..for a JavaFX Application which is throwing error.

Code

---------

java.awt.Desktop.getDesktop().browse(new URI("http://www.oracle.com"));

It runs in all Users Machine except one where the exception thrown is as below it is a Windows 7 machine. Tried to change the default browser from Eg Firefox to IE but no change in the Error. Tried to go to run and example go to http://www.oracle.com it opens in the default browser on the machine and changing the default browser does show affect right away.

Any Advise on the same,  tried Uninstall & Reinstall of JRE but it did not help. As per Doc Desktop (Java Platform SE 8 ) it does not say anything to get such Exception.

Exception

----------------

Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException

at javafx.fxml.FXMLLoader$MethodHandler.invoke(Unknown Source)

at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(Unknown Source)

at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)

at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)

at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)

at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)

at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)

at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)

at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)

at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)

at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)

at javafx.event.Event.fireEvent(Unknown Source)

at javafx.scene.Node.fireEvent(Unknown Source)

at javafx.scene.control.Hyperlink.fire(Unknown Source)

at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(Unknown Source)

at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(Unknown Source)

at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(Unknown Source)

at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(Unknown Source)

at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)

at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)

at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)

at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)

at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)

at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)

at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)

at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)

at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)

at javafx.event.Event.fireEvent(Unknown Source)

at javafx.scene.Scene$MouseHandler.process(Unknown Source)

at javafx.scene.Scene$MouseHandler.access$1500(Unknown Source)

at javafx.scene.Scene.impl_processMouseEvent(Unknown Source)

at javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)

at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)

at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$354(Unknown Source)

at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown Source)

at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unknown Source)

at com.sun.glass.ui.View.handleMouseEvent(Unknown Source)

at com.sun.glass.ui.View.notifyMouse(Unknown Source)

at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)

at com.sun.glass.ui.win.WinApplication.lambda$null$148(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.reflect.InvocationTargetException

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at sun.reflect.misc.Trampoline.invoke(Unknown Source)

at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at sun.reflect.misc.MethodUtil.invoke(Unknown Source)

... 49 more

Caused by: java.lang.NullPointerException

at java.awt.Desktop.getDesktop(Unknown Source)

at launcher.LauncherFXMLDocumentController.handleAction(LauncherFXMLDocumentController.java:766)

... 58 more

This discussion has been closed.