Signapk.jar giving error java.lang.ClassNotFoundException: sun.misc.BASE64Encoder - java

I have tried to make my app system app and i converted successfully on my windows machine but when I tried to run following same command on mac machine it kept on giving error. I have downloaded signapk.jar from different sources as well not able to run the command.
java -jar signapk.jar platform.x509.pem platform.pk8 device-owner.apk device-owner_sign.apk
Error:
Exception in thread "main" java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder
at com.android.signapk.SignApk.addDigestsToManifest(SignApk.java:169)
at com.android.signapk.SignApk.main(SignApk.java:325)
Caused by: java.lang.ClassNotFoundException: sun.misc.BASE64Encoder
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)

Looks like the app you're trying to run isn't JDK 9 compatible.
Try again using Java SE 8.

Related

Mac JDK11: Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/SQLException

New to Java here. Using IntelliJ. I wrote a simple "helloworld" Spring application that compiles just fine, but when I run it receive the following error:
/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/bin/java "-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=51884:/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -p /Users/winston.kotzan/Development/java-spring-helloworld/bin:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-aop-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-aspects-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-beans-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-context-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-context-indexer-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-context-support-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-core-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-expression-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-instrument-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-jcl-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-jdbc-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-jms-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-messaging-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-orm-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-oxm-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-test-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-tx-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-web-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-webflux-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-webmvc-5.1.3.RELEASE.jar:/Users/winston.kotzan/java/spring-framework-5.1.3/libs/spring-websocket-5.1.3.RELEASE.jar -m SpringHelloWorld/com.wakproductions.MainApp
Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/SQLException
at spring.core#5.1.3.RELEASE/org.springframework.core.Constants.<init>(Constants.java:67)
at spring.beans#5.1.3.RELEASE/org.springframework.beans.factory.xml.XmlBeanDefinitionReader.<clinit>(XmlBeanDefinitionReader.java:102)
at spring.context#5.1.3.RELEASE/org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:83)
at spring.context#5.1.3.RELEASE/org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:133)
at spring.context#5.1.3.RELEASE/org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:622)
at spring.context#5.1.3.RELEASE/org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:518)
at spring.context#5.1.3.RELEASE/org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144)
at spring.context#5.1.3.RELEASE/org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85)
at SpringHelloWorld/com.wakproductions.MainApp.main(MainApp.java:8)
Caused by: java.lang.ClassNotFoundException: java.sql.SQLException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 9 more
I suspect that it may have to do with the CLASSPATH. I tried setting the CLASSPATH environment variable, as well as adding this to the java command
-cp /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
But that does not seem to work. Might I have the incorrect CLASSPATH?
The comments about the module-info file led me to some clues. I took notice that IntelliJ seems to have created a module-info.java file with the following contents:
module SpringHelloWorld {
requires spring.context;
}
Did not realizing I was compiling a module. I deleted that file along with everything in the bin directory. Then I was able to run it by the Run menu using this option:
I can run it on the command line via:
java -Dfile.encoding=UTF-8 -classpath /Users/.../java-spring-helloworld/bin:/Users/.../<spring-framework-libs>... com.wakproductions.MainApp

Opening .jar file on mac using JDK 11 fails with RuntimeException

I am trying to open a .jar file (https://github.com/ptrckbnck/SQLChecker/releases) on my MAC Mojave 10.14 , I need it for my university course.
What I did:
installed java OpenJDK 11 as suggested here https://solarianprogrammer.com/2018/09/28/installing-openjdk-macos/
java -version
openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)
But when I run java -jar SQLChecker-1.0.jar I keep on getting the following exception:
Graphics Device initialization failed for : es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:222)
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:260)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:678)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
... 1 more
Exception in thread "main" java.lang.RuntimeException: No toolkit found
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:272)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:678)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:834)
I have read related thread Migration to JDK 11 + JavaFX 11 giving RuntimeException and downloaded also JavaFX 11, namely JavaFX Mac OS X SDK from here https://gluonhq.com/products/javafx/. I also run the following code:
export PATH_TO_FX=my/path/to/javafx-sdk-11/lib
and run HelloWorld test using JavaFX 11 as described here https://openjfx.io/openjfx-docs/. Everything worked fine but did not solve my original problem.
As was suggested by #Drimux in the related thread some libraries are missing in the OpenJDK distribution. He sad that those probably are libprism_es2.dylib, libprism_sw.dylib, libglass.dylib, libjavafx_font.dylib. So I copied those files from the javafx-sdk-11.0.1/lib into /Library/Java/JavaVirtualMachine/jdk-11.0.1.jdk/Contents/Home/lib and tried to run my .jar file again. Got new exception:
GLFactory.static - Platform: Mac OS X - not available: com.sun.prism.es2.MacGLFactory
java.lang.ClassNotFoundException: com.sun.prism.es2.MacGLFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at com.sun.prism.es2.GLFactory$FactoryLoader.run(GLFactory.java:108)
at com.sun.prism.es2.GLFactory$FactoryLoader.run(GLFactory.java:100)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at com.sun.prism.es2.GLFactory.<clinit>(GLFactory.java:97)
at com.sun.prism.es2.ES2Pipeline.<clinit>(ES2Pipeline.java:76)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:187)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
at java.base/java.lang.Thread.run(Thread.java:834)
java.lang.ClassNotFoundException: com.sun.glass.ui.mac.MacPlatformFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at com.sun.glass.ui.PlatformFactory.getPlatformFactory(PlatformFactory.java:42)
at com.sun.glass.ui.Application.run(Application.java:144)
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:258)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:269)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:678)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:834)
Failed to load Glass factory class
Exception in thread "main" java.lang.NullPointerException
at com.sun.glass.ui.Application.run(Application.java:144)
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:258)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:269)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:678)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:834)
This didn't fix the problem. If you need more information please request.
What else should I try?
If you have downloaded the jar from the first test release, when running it like:
java -jar SQLChecker-1.0.jar
you will get the posted exception.
As a first easy fix, if you have downloaded JavaFX 11 SDK, run this instead:
java --module-path /path-to/javafx-sdk-11/lib --add-modules javafx.controls,javafx.fxml -jar SQLChecker-1.0.jar
You can read about why you need those VM arguments here.
In any case, you shouldn't copy the native files from the JavaFX SDK to the JDK.
New releases
But there are two more new releases of SQLChecker.
If you try the last one:
java -jar SQLChecker-1.0.3.jar
that will work fine, without adding those extra arguments.
So what has changed?
They are distributing a fat Jar with the Maven shade plugin, and in order to work on JavaFX 11 on any platform, you need to include not only the jars, but also the native libraries.
As you can see, in this commit, by including the classifier tag for javafx.graphics, they added the required native libraries for Windows, Linux and Mac, as it has been also stated in this question.
If you want to know more about how to create a fat jar, see this doc.

java.lang.ClassNotFoundException: apple.laf.AquaTableUI

I use ScrumWorks Pro on my Mac OS X,but an error occurred and the main error message is:
java.lang.ClassNotFoundException: apple.laf.AquaTableUI
I installed the oracle JDK8 and java version is 1.8.0_111.
I searched for a long time and hardly had this solution.But I found AquaTableUI class in openjdk8.
I want to know if apple.laf.AquaTableUI is only available in openjdk,but not in Oracle.If not, is there a solution?
Looking forward to your answer,Thanks.

Running java program using packages in multiple folders

I'm trying to run a program with the following structure:
+src
+gui
-XL.java
-moreFiles.java
+menu
-guiFiles.java
+util
-utilFiles.java
+extra
-extraFiles.java
I'm trying to compile the code by calling
javac gui/XL.java
Which succeeds.
When I try running the code with
java gui.XL
I get the following error message:
Exception in thread "main" java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: java/lang/invoke/StringConcatFactory
at gui.XL.<init>(XL.java:25)
at gui.XL.main(XL.java:58)
Caused by: java.lang.NoClassDefFoundError: java/lang/invoke/StringConcatFactory
... 2 more
Caused by: java.lang.ClassNotFoundException: java.lang.invoke.StringConcatFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 2 more
I guess I have some problems with my classpath but I have no clue about how to fix it. Does anyone have any suggestions?
My problem had nothing to do with classpaths or that I wasn't using an IDE. My problem came from the fact that I was changing the 'java' command to run my java-openjdk-8 but my compiler still ran with java-openjdk-9. The solution was therefore
sudo update-alternatives --config javac #Change to java 8
sudo update-alternatives --config java #Change to java 8

Ionic error on android emulate

I have installed java JRE but i keep on getting. Am using windows 10 for development
After running ionic run android or ionic emulate android i get this error:
Exception in thread "main" java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78)
at org.gradle.wrapper.Install.createDist(Install.java:47)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:215)
at java.util.zip.ZipFile.<init>(ZipFile.java:145)
at java.util.zip.ZipFile.<init>(ZipFile.java:159)
at org.gradle.wrapper.Install.unzip(Install.java:160)
at org.gradle.wrapper.Install.access$400(Install.java:29)
at org.gradle.wrapper.Install$1.call(Install.java:70)
at org.gradle.wrapper.Install$1.call(Install.java:47)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
... 3 more
I have also set JRE_HOME in the environment variables
Probably it is related to something missing or corrupted.
You can find a similar question here, hope it helps.
First of all you have to install
node.js
apache ANT
JDK & JRE
Android SDK & Eclipse
After installation, you have to set software paths into environmental- variable. Then fire your npm install -g cordova. Without this PhoneGap will not be created.

Categories

Resources