如何解决在树莓派上出现的“java.lang.Exception: 找不到 web 浏览器”错误。

huangapple go评论67阅读模式
英文:

How to solve "java.lang.Exception: No web browser found" on Raspberry-Pi

问题

在Raspberry Pi OS上,我尝试安装多个带有JavaFX的Java版本,以便运行[rbox.jar| https://www.radiosparx.com/sslbypass/str/app/rbox.jar]。我发现的最佳Java版本是来自https://bell-sw.com/的版本,但即使使用它,我也无法使其工作。

在大多数情况下,我会遇到以下错误:

pi@raspberrypi:~/rbox $ java -jar rbox.jar
java.lang.Exception: 未找到 Web 浏览器
        at javafx.graphics/com.sun.javafx.application.HostServicesDelegate$StandaloneHostService.showDocument(HostServicesDelegate.java:146)
        at javafx.graphics/javafx.application.HostServices.showDocument(HostServices.java:115)
        at anywheresoftware.b4j.objects.JFX.ShowExternalDocument(JFX.java:138)
        at com.radiosparx.rbox.main$ResumableSub_AppStart.resume(main.java:150)
        at com.radiosparx.rbox.main._appstart(main.java:83)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
        at com.radiosparx.rbox.main.start(main.java:37)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
        at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
        at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
        at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
        at java.base/java.lang.Thread.run(Thread.java:834

我已安装了Chromium和Dillo。

pi@raspberrypi:~ $ sudo update-alternatives --config x-www-browser
在提供 /usr/bin/x-www-browser 的替代方案中,共有 2 个选择。

  选择       路径                       优先级   状态
------------------------------------------------------------
* 0            /usr/bin/chromium-browser   90        自动模式
  1            /usr/bin/chromium-browser   90        手动模式
  2            /usr/bin/dillo              50        手动模式

非常感谢任何帮助。

英文:

On Raspberry Pi OS, I've tried to install multiple versions of Java with JavaFX in order to run [rbox.jar| https://www.radiosparx.com/sslbypass/str/app/rbox.jar]. Best Java version I've found was the one from https://bell-sw.com/, but even with it I was not able to make it work.

On most of them I get the following error:

pi@raspberrypi:~/rbox $ java -jar rbox.jar
java.lang.Exception: No web browser found
        at javafx.graphics/com.sun.javafx.application.HostServicesDelegate$StandaloneHostService.showDocument(HostServicesDelegate.java:146)
        at javafx.graphics/javafx.application.HostServices.showDocument(HostServices.java:115)
        at anywheresoftware.b4j.objects.JFX.ShowExternalDocument(JFX.java:138)
        at com.radiosparx.rbox.main$ResumableSub_AppStart.resume(main.java:150)
        at com.radiosparx.rbox.main._appstart(main.java:83)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
        at com.radiosparx.rbox.main.start(main.java:37)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
        at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
        at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
        at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
        at java.base/java.lang.Thread.run(Thread.java:834

I have Chromium and Dillo

pi@raspberrypi:~ $ sudo update-alternatives --config x-www-browser
There are 2 choices for the alternative x-www-browser (providing /usr/bin/x-www-browser).

  Selection    Path                       Priority   Status
------------------------------------------------------------
* 0            /usr/bin/chromium-browser   90        auto mode
  1            /usr/bin/chromium-browser   90        manual mode
  2            /usr/bin/dillo              50        manual mode

Any help would be much appreciated.

答案1

得分: 2

错误信息非常清楚,不是吗?该软件正试图通过HostServices.showDocument方法显示文档(可能是一些HTML帮助文本或类似内容),但在Raspi上未能找到浏览器。因此问题是,您的Raspi上是否安装了浏览器?如果没有,请安装一个。否则,请查看HostServicesDelegate$StandaloneHostService.showDocument中的代码,看看是否可以通过其查找方法找到它。

相关代码可以在这里找到:https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/java/com/sun/javafx/application/HostServicesDelegate.java

英文:

The error message is pretty clear, isn't it? The software is trying to show a document (probably some HTML help text or something like this) via the HostServices.showDocument method and fails to find a browser on the Raspi. So the question is, do you have a browser installed on your Raspis? If not, do it. Otherwise look at the code in HostServicesDelegate$StandaloneHostService.showDocument and see whether it can be located via its lookup method.

The relevant code can be found here: https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/java/com/sun/javafx/application/HostServicesDelegate.java

huangapple
  • 本文由 发表于 2020年10月2日 00:44:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/64159822.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定