Error about sun/misc/BASE64Encoder on Eclipse [duplicate] - java

This question already has answers here:
import sun.misc.BASE64Encoder results in error compiled in Eclipse
(15 answers)
Closed 1 year ago.
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
but this project is work fine in windows 10 computer, and i don't use any about base64Encoder
eclipse Version: Photon Milestone 3 (4.8.0M3)
JRE java se 9.0
edit!
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

As others have pointed out already, this is a compatibility issue—you need exactly Java 8 to run 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.

The Android code you are using is trying to use the sun.misc.BASE64Encoder class.
This deprecated class has been removed from Java 9 so this is not going to work.
You will need to switch back to Java 8 or find an update to the Android code (if there is one).

I'm working with Windows 7. I had to change the preferences and the ini file. Both had C:\Program Files\Java\jdk-12.0.1\bin which I changed to C:\Program Files\Java\jre1.8.0_221\bin. It now works!

In my case it was something very crazy.
I have to download the eclipse IDE Version NEON
Since the project is old almost from 2014
Attached the url of the IDE for which you need it:
Eclipse IDE NEON
I also had to follow the same installation steps

Related

Unsupported class file major version 61 with TomEE 8

Tried to follow the answers to other similar questions here, unfortunately, to no avail. We are upgrading our application from JAVA 7 to JAVA 17. The code compiles just fine, the problem is when we try to run the .war file on apache-tomee-plume-8.0.8.
JAVA_HOME is set properly:
JAVA_HOME
As well as path:
PATH
Here is the log error message:
Caused by: java.lang.RuntimeException: Unable to read class definition for com.ui.AccountListLight$SubListDataModel
at org.apache.xbean.finder.AnnotationFinder.readClassDef(AnnotationFinder.java:1180)
at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:153)
at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:166)
at org.apache.openejb.config.FinderFactory$OpenEJBAnnotationFinder.<init>(FinderFactory.java:546)
at org.apache.openejb.config.FinderFactory.newFinder(FinderFactory.java:267)
at org.apache.openejb.config.FinderFactory.create(FinderFactory.java:80)
at org.apache.openejb.config.FinderFactory.createFinder(FinderFactory.java:69)
at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoader.java:878)
... 46 more
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 61
at org.apache.xbean.asm9.ClassReader.<init>(ClassReader.java:189)
at org.apache.xbean.asm9.ClassReader.<init>(ClassReader.java:170)
at org.apache.xbean.asm9.ClassReader.<init>(ClassReader.java:156)
at org.apache.xbean.asm9.ClassReader.<init>(ClassReader.java:277)
at org.apache.xbean.finder.AnnotationFinder.readClassDef(AnnotationFinder.java:1176)
Yes, I understand that the issue is that I compiled on JAVA 17 and somehow TomEE is trying to run it on an older version (probably JAVA 7 as that was what I had installed before), but considering I removed all JRE/JDK stuff for JAVA 7 on my machine and all there is in it is JAVA 17, how does it keep happening? Thank you for your time.
The problem has nothing to do with Java being unable to read your Java 17-compiled classes. Looking at the stack trace, the problem is that org.apache.xbean.asm9.ClassReader is unable to read your class file. This particular ClassReader is one that TomEE uses to load your application. It is not surprising that TomEE can't read Java 17 applications, since the last release was in August, before Java 17 came out. It was itself compiled using an older version of Java. Hopefully a future version of TomEE will fix this issue.

No Eclipse versions will install

Trying to install any version of Eclipse will fail with varying errors.
Sometimes I get the error:
with error log
!ENTRY org.eclipse.osgi 4 0 2019-02-19 19:49:23.951
!MESSAGE Application error
!STACK 1
java.lang.NullPointerException
at org.eclipse.swt.widgets.Control.internal_new_GC(Control.java:2180)
at org.eclipse.swt.graphics.GC.<init>(GC.java:177)
at org.eclipse.swt.graphics.GC.<init>(GC.java:138)
at org.eclipse.jface.dialogs.Dialog.initializeDialogUnits(Dialog.java:937)
here.
Other times I open the installer and I get a window with dialog boxes that are messed up
clicking on the visible box gives this error (text here). (Note: This only happens when I have an older version of Eclipse running).
Downloading an older version of Eclipse isn't helpful either. Trying to install Neon gives this error. It mentions something about a ImageBuilderInternalException on something called MattStuff, but it's not the only type of error and I have no clue where this MattStuff is so I may delete it.
Trying to install Neon now gives another error
Trying to get Mars gives this error.
Trying to directory get the Eclipse application instead of the Eclipse Installer (as suggested by #howlger) gives these errors. Note: Clicking on details does not do anything.

Scala incompatibility with Java 9 - java.lang.NoClassDefFoundError

Just run a sample Scala SBT project after installing Java 9 on my pc and I took this exception.
I already tried some solutions that I found but nothing.
Is there any incompatibility between Java 9 and Scala?
Scala Version: 2.12.3
Java Version: java version "9"
IDE: IntelliJ
Thanks in advance.
info] Compiling 7 Scala sources and 1 Java source to /Users/ermis/Projects/begining-scala/target/scala-2.12/classes...
[info] p.a.h.EnabledFilters - Enabled Filters (see <https://www.playframework.com/documentation/latest/Filters>):
play.filters.csrf.CSRFFilter
play.filters.headers.SecurityHeadersFilter
play.filters.hosts.AllowedHostsFilter
[info] play.api.Play - Application started (Dev)
Uncaught error from thread [play-dev-mode-akka.actor.default-
dispatcher-2]: javax/xml/bind/DatatypeConverter, shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for for ActorSystem[play-dev-mode]
java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
at io.jsonwebtoken.impl.Base64Codec.decode(Base64Codec.java:26)
at io.jsonwebtoken.impl.DefaultJwtBuilder.signWith(DefaultJwtBuilder.java:106)
at play.api.mvc.JWTCookieDataCodec$JWTFormatter.format(Cookie.scala:710)
at play.api.mvc.JWTCookieDataCodec.encode(Cookie.scala:569)
at play.api.mvc.JWTCookieDataCodec.encode$(Cookie.scala:567)
at play.api.mvc.DefaultJWTCookieDataCodec.encode(Cookie.scala:760)
at play.api.mvc.FallbackCookieDataCodec.encode(Cookie.scala:734)
at play.api.mvc.FallbackCookieDataCodec.encode$(Cookie.scala:733)
at play.api.mvc.DefaultSessionCookieBaker.encode(Session.scala:95)
at play.api.mvc.CookieBaker.encodeAsCookie(Cookie.scala:414)
at play.api.mvc.CookieBaker.encodeAsCookie$(Cookie.scala:413)
at play.api.mvc.DefaultSessionCookieBaker.encodeAsCookie(Session.scala:95)
at play.api.mvc.Result.$anonfun$bakeCookies$2(Results.scala:281)
at scala.Option.map(Option.scala:146)
at play.api.mvc.Result.bakeCookies(Results.scala:280)
at play.core.server.common.ServerResultUtils.prepareCookies(ServerResultUtils.scala:227)
at play.core.server.AkkaHttpServer.$anonfun$executeAction$3(AkkaHttpServer.scala:302)
at akka.http.scaladsl.util.FastFuture$.strictTransform$1(FastFuture.scala:41)
at akka.http.scaladsl.util.FastFuture$.transformWith$extension1(FastFuture.scala:55)
at akka.http.scaladsl.util.FastFuture$.flatMap$extension(FastFuture.scala:26)
at play.core.server.AkkaHttpServer.executeAction(AkkaHttpServer.scala:301)
at play.core.server.AkkaHttpServer.executeHandler(AkkaHttpServer.scala:254)
I tried this but didn't work.
--add-modules java.xml.bind
or
--add-modules java.se.ee
Try adding a compiler option to temporarily fix this:
--add-modules java.se.ee
since the Module shared by Java EE would not be resolved by default in JDK9.
You can also keep track of the issue to Support JDK 9 at scala-dev repository for updates as well.
I just remove Java 9 until someone gives me some lights and the compile works as usual.

Eclipse Error on Mavericks: posix_spawn is not a supported process launch mechanism on this platform

I'm using OS X Mavericks. I've installed apple's Java and JDK 8 and 7 from Oracle. Downloaded Android ADT. When I run eclipse, it shows me this error on build. I couldn't use eclipse.
Do you have any idea about that problem?
An internal error occurred during: "Building workspace". posix_spawn
is not a supported process launch mechanism on this platform.
java.lang.Error: posix_spawn is not a supported process launch mechanism on this platform.
at java.lang.UNIXProcess$1.run(UNIXProcess.java:105)
at java.lang.UNIXProcess$1.run(UNIXProcess.java:94)
at java.security.AccessController.doPrivileged(Native Method)
at java.lang.UNIXProcess.<clinit>(UNIXProcess.java:92)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1023)
at java.lang.Runtime.exec(Runtime.java:620)
at java.lang.Runtime.exec(Runtime.java:485)
at com.android.ide.eclipse.adt.internal.build.builders.PreCompilerBuilder.execAapt(PreCompilerBuilder.java:1225)
at com.android.ide.eclipse.adt.internal.build.builders.PreCompilerBuilder.handleResources(PreCompilerBuilder.java:1123)
at com.android.ide.eclipse.adt.internal.build.builders.PreCompilerBuilder.build(PreCompilerBuilder.java:720)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:733)
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:246)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:299)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:302)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:358)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:381)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
The problem is special language characters (Probably i-İ in Turkish as in this case).
Here is how I solved step by step:
Change your preferred language to English as primary. (How to?)
Restart Mac.
Start Eclipse and create a project. (Your problem should have been
solved right now)
Close eclipse.
Change your preferred language to
Turkish.
Restart Mac.
Since the problem is only faced by Turkish users, I will also add translation of above as:
Problem dildeki özel karakterler (Muhtemelen Türkçe'deki i-İ harfi, bu durumda).
Adım adım çözüm:
Sistem dilinizi İngilizce'ye çevirin. (Nasıl mı?)
Mac a restart atın.
Eclipse i açın ve proje oluşturun. (Sorununuz bu aşamada çözülmüş olması lazım)
Eclipse i kapatın.
Sistem dilinizi Türkçe'ye çevirin.
Mac a restart atın.
The workaround for now is to run with -Djdk.lang.Process.launchMechanism=fork until this is resolved.
Instead of uninstalling the new JDK you can configure eclipse to use specific jdk by manipulating Eclipse.app/Contents/info.plist
Open info.plist with a text editor and add below line (I am adding 1.6.0 since I use jdk6, if you want to use jdk7 use 1.7.0)
<string>-vm</string><string>/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/java</string>
in the beginning of array tag
<key>Eclipse</key>
<array>
you can configure Run Configuration if you want and pass vm argument as
"-Duser.language=us"
I had this issue on Mac OS 10 with Java SDK 1.8.0. Updating Java SDK solved my problem.
You had already solve your problem but If problem can occur again, change your region to USA. This is because of Turkish language's I and İ is different than English.

Creating a SWT.MOZILLA browser on Windows 64 bit and SWT 4.3

I'm trying to create an SWT Browser widget of the SWT.MOZILLA type under windows 8 64Bit with SWT 4.3 64Bit.
According to this, SWT 4.3 should support 64 Bit version on XULRunner 10.x or 24.x
So, I have downloaded both the 10.x and 24.x 64 versions from here and unzipped under c:\xulrunner10 and c:\xulrunner24 respectively.
If I start my java app pointing to xulrunner10 (using the VM argument -Dorg.eclipse.swt.browser.XULRunnerPath=C:\xulrunner10) it works, however if I try with xulrunner24 (using the VM argument -Dorg.eclipse.swt.browser.XULRunnerPath=C:\xulrunner24) I get the follwoing error:
Exception in thread "main" org.eclipse.swt.SWTError: XPCOM error 0x80004005
at org.eclipse.swt.browser.Mozilla.error(Unknown Source)
at org.eclipse.swt.browser.Mozilla.initXULRunner(Unknown Source)
at org.eclipse.swt.browser.Mozilla.create(Unknown Source)
at org.eclipse.swt.browser.Browser.<init>(Unknown Source)
I also noticed that I get the same error if pointing to unexisting directory, however the folder c:\xulrunner24 exists and contains all the files as well as xulrunner.exe.
How can I make xulrunner 24.x 64bit embeddable in my swt 4.3 app?
Got it!
It's an error on SWT wiki: xulrunner 24.x requires SWT 4.4.
I've installed swt-4.4M5 and now I can embed xurlrunner 24 64bit
I realize that this question is old and already has an accepted answer, but the download location mentioned in the question is no longer valid (http://wiki.mozilla-x86-64.com/Download), and the same issue has been posted about several times.
With 64-bit 4.3 SWT I was able to fix this exception by using XULRunner version 1.9.2.25 runtimes. Originally I found the download from here: https://osdn.net/projects/sfnet_runawfe/downloads/SRC%20and%20BIN%20files/extras/xulrunner-1.9.2.25-win64.zip/
However, I have also re-hosted it as xulrunner-1.9.2.25.en-US.win64.zip.
Full explanation posted in my answer here: https://stackoverflow.com/a/44848877/3300205
Looks like this might be Eclipse bug 411996 (same error and stack trace).

Categories