Eclipse “发生错误。请参阅日志文件”

Eclipse "An error has occurred. See the log file"

提问人:Raonic 提问时间:9/22/2022 更新时间:3/23/2023 访问量:765

问:

Eclipse “发生错误。请参阅日志文件“C:\Program Files\Android\adt-bundle-windows-x86_64-20130219\eclipse\configuration\1663787406897.log。

实际日志为

!SESSION 2022-09-21 16:03:50.380 -----------------------------------------------
eclipse.buildId=v21.1.0-569685
java.version=19
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=pt_BR
Framework arguments:  -XX:-UseCompressedOops -product com.android.ide.eclipse.adt.package.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -XX:-UseCompressedOops -product com.android.ide.eclipse.adt.package.product
!ENTRY org.eclipse.osgi 4 0 2022-09-21 16:03:50.631
!MESSAGE error loading hook: org.eclipse.osgi.internal.baseadaptor.BaseHookConfigurator
!STACK 0
java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.net.URLClassLoader.addURL(java.net.URL) accessible: module java.base does not "opens java.net" to unnamed module @62043840
    at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:387)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:363)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:311)
    at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:201)
    at java.base/java.lang.reflect.Method.setAccessible(Method.java:195)
    at org.eclipse.osgi.internal.baseadaptor.BaseStorage.findMethod(BaseStorage.java:174)
    at org.eclipse.osgi.internal.baseadaptor.BaseStorage.findMethod(BaseStorage.java:181)
    at org.eclipse.osgi.internal.baseadaptor.BaseStorage.findAddURLMethod(BaseStorage.java:165)
    at org.eclipse.osgi.internal.baseadaptor.BaseStorage.<init>(BaseStorage.java:135)
    at org.eclipse.osgi.internal.baseadaptor.BaseHookConfigurator.addHooks(BaseHookConfigurator.java:24)
    at org.eclipse.osgi.baseadaptor.HookRegistry.loadConfigurators(HookRegistry.java:178)
    at org.eclipse.osgi.baseadaptor.HookRegistry.initialize(HookRegistry.java:100)
    at org.eclipse.osgi.baseadaptor.BaseAdaptor.<init>(BaseAdaptor.java:98)
    at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.createAdaptor(EclipseStarter.java:737)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:258)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
!ENTRY org.eclipse.osgi 4 0 2022-09-21 16:03:50.690
!MESSAGE Startup error
!STACK 1
java.lang.NullPointerException: Cannot invoke "org.eclipse.osgi.internal.baseadaptor.BaseStorage.initialize(org.eclipse.osgi.baseadaptor.BaseAdaptor)" because "this.storage" is null
    at org.eclipse.osgi.baseadaptor.BaseAdaptor.initializeStorage(BaseAdaptor.java:123)
    at org.eclipse.osgi.framework.internal.core.Framework.<init>(Framework.java:192)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:262)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1438)

我找不到任何处理此问题的董事会

java android eclipse

评论

0赞 Thomas Kläger 9/22/2022
您正在尝试使用当前的 JVM (java.version=19) 运行旧版本的 eclipse(根据 2013 年 2 月 19 日路径中的信息,这是 9 年前的事了)。这根本行不通。如果必须使用旧版本的 eclipse,则必须使用 Java 1.7 或 Java 1.8 运行它。
0赞 Thomas Kläger 9/22/2022
另请注意,自 2017 年左右以来,针对 Android 进行开发的首选方法是使用 Android Studio。从 2013 年开始,Android 中可能有一些功能无法与 Eclipse+ADT 一起使用。
0赞 Raonic 9/22/2022
我几分钟前就想通了,但谢谢你的回答。是的,我必须使用这个版本的 Eclipse,因为这是我们的老师分配给我们的版本,但我们将在下一个 Bimester 中切换到 Android Studio!

答:

-4赞 jonadab_mg 3/22/2023 #1

你的eclipse不起作用,因为你试图打开一个与它不兼容的java版本,所以你可以试试这个(它对我有用): 转到文件资源管理器并搜索您的 eclipse 文件夹并打开,搜索文件 eclipse.in 并将其放在:openFile

-vm
C:\Program Files\Java\YouJDKVersion\bin\javaw.exe

来源:JVM eclipse.ini