gpt4 book ai didi

java - `groovyConsole` 无法使用 Java 8 在 Ubuntu 18.04 上启动,如何解决?

转载 作者:行者123 更新时间:2023-12-04 17:33:14 25 4
gpt4 key购买 nike

当我从终端运行 groovyConsole 时,它​​会异常放弃:

$ groovyConsole 
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:116)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:138)
Caused by: groovy.lang.MissingMethodException: No signature of method: javax.swing.JMenu.setMnemonic() is applicable for argument types: (java.lang.String) values: [F]
Possible solutions: setMnemonic(char), setMnemonic(int), getMnemonic()
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:71)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:77)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:80)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:177)
at groovy.ui.view.BasicMenuBar$_run_closure1.doCall(BasicMenuBar.groovy:22)
at groovy.ui.view.BasicMenuBar$_run_closure1.doCall(BasicMenuBar.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035)
at groovy.lang.Closure.call(Closure.java:420)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.util.FactoryBuilderSupport.dispatchNodeCall(FactoryBuilderSupport.java:899)
at groovy.util.FactoryBuilderSupport.doInvokeMethod(FactoryBuilderSupport.java:791)
at groovy.util.FactoryBuilderSupport.invokeMethod(FactoryBuilderSupport.java:511)
at groovy.util.FactoryInterceptorMetaClass.invokeMethod(FactoryBuilderSupport.java:1322)
at groovy.lang.GroovyObjectSupport.invokeMethod(GroovyObjectSupport.java:46)
at groovy.lang.Script.invokeMethod(Script.java:80)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:74)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:83)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:169)
at groovy.ui.view.BasicMenuBar.run(BasicMenuBar.groovy:21)
at groovy.util.FactoryBuilderSupport.build(FactoryBuilderSupport.java:1181)
at groovy.util.FactoryBuilderSupport.build(FactoryBuilderSupport.java:1164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:352)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:68)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:169)
at groovy.ui.Console$__clinit__closure25.doCall(Console.groovy:267)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:41)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
at groovy.ui.ConsoleView$_run_closure1.doCall(ConsoleView.groovy:62)
at groovy.ui.ConsoleView$_run_closure1.doCall(ConsoleView.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035)
at groovy.lang.Closure.call(Closure.java:420)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.util.FactoryBuilderSupport.dispatchNodeCall(FactoryBuilderSupport.java:899)
at groovy.util.FactoryBuilderSupport.doInvokeMethod(FactoryBuilderSupport.java:791)
at groovy.util.FactoryBuilderSupport.invokeMethod(FactoryBuilderSupport.java:511)
at groovy.util.FactoryInterceptorMetaClass.invokeMethod(FactoryBuilderSupport.java:1322)
at groovy.lang.GroovyObjectSupport.invokeMethod(GroovyObjectSupport.java:46)
at groovy.lang.Script.invokeMethod(Script.java:80)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:74)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:177)
at groovy.ui.ConsoleView.run(ConsoleView.groovy:59)
at groovy.util.FactoryBuilderSupport.build(FactoryBuilderSupport.java:1181)
at groovy.util.FactoryBuilderSupport.build(FactoryBuilderSupport.java:1164)
at groovy.util.FactoryBuilderSupport$build$4.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
at groovy.ui.Console.run(Console.groovy:308)
at groovy.ui.Console$run$1.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:169)
at groovy.ui.Console.run(Console.groovy:271)
at groovy.ui.Console$run$0.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at groovy.ui.Console.main(Console.groovy:205)
... 6 more

enter code here

我的系统是:

$ groovy --version
Groovy Version: 2.4.16 JVM: 1.8.0_222 Vendor: Private Build OS: Linux
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.3 LTS (Bionic Beaver)"

如何避免这个错误?

最佳答案

您正面临 Debian 中报告的已知问题, UbuntuGroovy问题跟踪器。

问题已在 Groovy 版本 2.6.0-alpha-1 中修复。该修复程序已在 Ubuntu 软件包版本 2.4.17-4ubuntu1 和 Debian 软件包版本 2.4.17-2 中反向移植(参见 Debian patch)。

在 Ubuntu Bionic 18.04 LTS 中,可用的 Groovy 包版本为 2.4.16-1ubuntu1~18.04.1(在 Debian 中为 2.4.16-2)。
版本 2.4.17-4ubuntu1 在 Ubuntu Focal 20.04 LTS 中可用(目前在 Debian 测试中为 2.4.20-1)。

所以我想对您来说最简单的解决方案可能是升级到 Ubuntu Focal 20.04 LTS 版本。

另一种方法是仅安装来自 Focal 20.04 的 groovy 包并保持其他包不变(即保留 Ubuntu Bionic 18.04 提供的版本)。这种解决方案涉及包固定。您可以在 Ubuntu wiki 中阅读更多相关信息, Debian wiki或者在这个优秀的Debian administrator's handbook .

关于java - `groovyConsole` 无法使用 Java 8 在 Ubuntu 18.04 上启动,如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57800278/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com