Java 和 Meow 的问题

Java 和 Meow 的问题

我安装了程序在 Ubuntu 14.4 上,Gnome Shell 3.10.4(它是一个 GNOME 菜单编辑器)。系统更新到 Java 8。当我从命令行运行程序时,我得到以下信息:

meow
Exception in thread "main" java.lang.ExceptionInInitializerError
    at org.medit.gui.Runner$.main(Runner.scala:15)
    at org.medit.gui.Runner.main(Runner.scala)
Caused by: java.awt.HeadlessException
    at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:207)
    at java.awt.Window.<init>(Window.java:535)
    at java.awt.Frame.<init>(Frame.java:420)
    at javax.swing.JFrame.<init>(JFrame.java:218)
    at org.medit.gui.Main$.<init>(Main.scala:23)
    at org.medit.gui.Main$.<clinit>(Main.scala)
    ... 2 more

有什么想法吗? (我有Java 经验。)

dpkg -l '*jre*' | grep '^ii'

输出以下内容

ii  default-jre-headless                        2:1.7-51                                i386         Standard Java or Java compatible Runtime (headless)
ii  openjdk-7-jre-headless:i386                 7u111-2.6.7-0ubuntu0.14.04.3            i386         OpenJDK Java runtime, using Hotspot JIT (headless)
ii  openjdk-8-jre:i386                          8u91-b14-0ubuntu4~14.04                 i386         OpenJDK Java runtime, using Hotspot JIT
ii  openjdk-8-jre-headless:i386                 8u91-b14-0ubuntu4~14.04                 i386         OpenJDK Java runtime, using Hotspot JIT (headless)

当我尝试删除它时,openjdk-7-jre-headless:i386它也想删除default-jre-headless。 (认为​​这可能与 v8 冲突。)

===========

编辑:将 Java 8 设置为默认值后出现错误(对于版本,它显示“java 版本“1.8.0_111””):

Exception in thread "AWT-EventQueue-0" java.util.NoSuchElementException: key not found: abridged
    at scala.collection.MapLike$class.default(MapLike.scala:228)
    at scala.collection.AbstractMap.default(Map.scala:58)
    at scala.collection.mutable.HashMap.apply(HashMap.scala:64)
    at org.medit.core.icons.IconFinder$$anonfun$loadIcon$2.apply(IconFinder.scala:46)
    at org.medit.core.icons.IconFinder$$anonfun$loadIcon$2.apply(IconFinder.scala:36)
    at scala.collection.mutable.MapLike$class.getOrElseUpdate(MapLike.scala:189)
    at scala.collection.mutable.AbstractMap.getOrElseUpdate(Map.scala:91)
    at org.medit.core.icons.IconFinder$.loadIcon(IconFinder.scala:36)
    at org.medit.core.icons.ImageScaler.run(ImageScaler.scala:11)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

答案1

Meow 失败是因为它是在无头 JRE 上启动的,而该 JRE 无法显示窗口(因此会出现相当模糊的错误消息)。

要解决此问题,最简单的选择是重新配置默认 JVM:

sudo update-java-alternatives -s java-1.8.0-openjdk-amd64

您可以通过运行来检查默认 JVM 是什么

java -version

如果正确选择 OpenJDK 8 作为默认值,您应该得到类似的信息

openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)

(版本号可能略有不同,重要的部分是“1.8.0”)。

相关内容