关于 Eclipse 上的 sun/misc/BASE64Encoder 的错误

2022-01-21 00:00:00 base64 java eclipse eclipse-photon

当我在 mac 中运行我的应用程序并显示此消息时构建过程中发生错误.在项目IMPEXP"上运行构建器Android Package Builder"时出错.sun/misc/BASE64Encoder

when i run my app in mac, and show up this message Errors occurred during the build. Errors running builder 'Android Package Builder' on project 'IMPEXP'. sun/misc/BASE64Encoder

但是这个项目在 windows 10 计算机上运行良好,我不使用任何关于 base64Encoder

but this project is work fine in windows 10 computer, and i don't use any about base64Encoder

eclipse 版本:Photon Milestone 3 (4.8.0M3)JRE java se 9.0

eclipse Version: Photon Milestone 3 (4.8.0M3) JRE java se 9.0

编辑!

我在下面找到了类似的东西

i found something like below

!ENTRY org.eclipse.core.resources 4 2 2017-11-09 11:50:09.047
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
!STACK 0
java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder
    at com.android.sdklib.internal.build.SignedJarBuilder.<init>(SignedJarBuilder.java:177)
    at com.android.sdklib.build.ApkBuilder.init(ApkBuilder.java:446)
    at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:422)
    at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:362)
    at com.android.ide.eclipse.adt.internal.build.BuildHelper.finalPackage(BuildHelper.java:391)
    at com.android.ide.eclipse.adt.internal.build.BuildHelper.finalDebugPackage(BuildHelper.java:359)
    at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:632)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:330)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:405)
    at org.eclipse.core.internal.resources.Project$1.run(Project.java:566)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2240)
    at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:544)
    at org.eclipse.core.internal.resources.Project.build(Project.java:120)
    at com.android.ide.eclipse.adt.internal.project.ProjectHelper.doFullIncrementalDebugBuild(ProjectHelper.java:1143)
    at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:155)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
    at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
    at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: java.lang.ClassNotFoundException: sun.misc.BASE64Encoder cannot be found by com.android.ide.eclipse.base_23.0.7.2120684
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
    ... 23 more

推荐答案

正如其他人已经指出的那样,这是一个兼容性问题——你需要 Java 8 才能运行 Eclipse.

As others have pointed out already, this is a compatibility issue—you need exactly Java 8 to run Eclipse.

  • 如果您还没有 JDK 8,请安装它.
  • 在 Eclipse 中,转到 Window > Preferences > Installed JREs.确保 Java 8 出现在列表中并被选中.之后,关闭 Eclipse.
  • 此外,eclipse.ini 还引用了它使用的 Java 虚拟机.确保它指向的 VM 是 Java 8(请参阅有关如何找到它以及如何设置 VM 首选项的链接).
  • 重新启动 Eclipse 并重试.
  • Install JDK 8 if you don’t have it already.
  • In Eclipse, go to Window > Preferences > Installed JREs. Make sure Java 8 appears in the list and is selected. After that, close Eclipse.
  • Additionally, eclipse.ini also has a reference to the Java VM it uses. Make sure the VM it points to is Java 8 (see link on how to find it and how to set VM preferences).
  • Restart Eclipse and try again.

相关文章