为什么这个由oracle提供的Java代码在运行时抛出异常?

时间:2016-11-24 19:47:41

标签: java

我有一些示例代码,它显示了如何在java中显示html,在运行main方法时抛出以下异常:

scala> val t = Int
t: Int.type = object scala.Int

scala> t.MaxValue
res2: Int = 2147483647

为什么会抛出此异常,如何诊断并解决此问题?

Java Sample Code Provided by Oracle:

java.lang.RuntimeException: Exception in Application start method
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$152(LauncherImpl.java:182)
    at com.sun.javafx.application.LauncherImpl$$Lambda$7/4781857.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ExceptionInInitializerError
    at WebViewSample.start(WebViewSample.java:44)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:863)
    at com.sun.javafx.application.LauncherImpl$$Lambda$57/32558093.run(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(PlatformImpl.java:326)
    at com.sun.javafx.application.PlatformImpl$$Lambda$52/5240121.run(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
    at com.sun.javafx.application.PlatformImpl$$Lambda$55/20053859.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
    at com.sun.javafx.application.PlatformImpl$$Lambda$54/20131899.run(Unknown Source)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$145(WinApplication.java:101)
    at com.sun.glass.ui.win.WinApplication$$Lambda$43/11473758.run(Unknown Source)
    ... 1 more
Caused by: java.lang.NullPointerException
at Browser.<clinit>(WebViewSample.java:78)

注意:我知道空指针异常是什么,我只是不知道为什么它被抛出这里以及主方法中的launcg(args)是如何相关的

0 个答案:

没有答案