NoClassDefFoundError when running UI Automator Viewer - java

I'm trying to run Android's UI Automator Viewer on my Windows machine. I have the following installed:
Latest Android Studio
JDK 8
Latest Android SDK
I'm running the following command:
uiautomatorviewer
When I run it, I get an error related to SWT:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/widgets/Control
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:650)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.widgets.Control
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 7 more
Anyone know what I'm missing?

Related

IntelliJ keeps giving a JNI error related to Spark

I installed IntelliJ and Java SDK, updated my environment variables, and in "Edit Configurations" the correct JDK is listed under "Build and Run". And I still keep getting a JNI error. None of the other answers have worked so far, I'm completely stuck. Spark is installed at C:\Spark\spark-3.0.3-bin-hadoop2.7 (environment variables have been update). In misc.xml I have:
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
The full error is below. Why does this keep happening?
java.lang.NoClassDefFoundError: org/apache/spark/sql/SparkSession
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.apache.spark.sql.SparkSession
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
Error: A JNI error has occurred, please check your installation and try again
Picked up JAVA_TOOL_OPTIONS: -agentpath:"c:\windows\fireeye\javaagentdll.dll"
Exception in thread "main"
Process finished with exit code 1

I can't open a jar file

If through terminal I get a cant get permission error. If through double clicking I get a 'could not be launched - check the console for possible error messages'
Error from terminal
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: com/esotericsoftware/kryo/Serializer
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:650)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)
Caused by: java.lang.ClassNotFoundException: com.esotericsoftware.kryo.Serializer
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 7 more

Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/Capabilities

I’m trying to run my program through the command line and i’m getting the above exception. I’ve compiled it through the cmd and it went fine. I am also running the program in Eclipse with no issues. Why do i get this exception from the command line?
Here is the full exception:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread “main” java.lang.NoClassDefFoundError:
org/openqa/selenium/Capabilities
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.Capabilities
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 7 more

How to add Jar to Submodule in Android Studio

I create a proyect in Android Studio, and I have a submodule where all logic it's done, I try to add a .jar but it don't work I get an error, but Android Studio don't show any error until I try to execute and compile.
This is the error:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: es/uam/eps/multij/Tablero
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: es.uam.eps.multij.Tablero
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
BTW:if I extract the jar and create a package with the same path it works.
This is the gradel: https://i.stack.imgur.com/NjZ4a.png

Jnlp can be launched from Cygwin but not MS-DOS using javaws

I can launch a JNLP file from Cygwin but not MS-DOS on the same machine. I am using javaws and getting the error to the effect that javaw.exe not found. I read http://javatechniques.com/blog/launching-java-webstart-from-the-command-line/. that one can use java compiler to do the launch So I tried that as well that looks something like this:
c:\Program Files\Java\jdk1.8.0_60\jre\bin>java -classpath
"C:\Program Files\Java\jdk1.8.0_60\jre\lib\javaws.jar;
C:\Program Files\Java\jdk1.8.0_60\jre\lib\deploy.jar"
-Djnlpx.home="C:Program Files\Java\jdk1.8.0_60/jre/bin"
-Djnlpx.jvm="C:\Program Files\Java\jdk1.8.0_60\jre\bin\javaw.exe"
-Djnlpx.remove=true
-Djnlpx.splashport=-1
com.sun.javaws.Main c:\tmp2\new_3.jnlp
And when I do that I get this error:
Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/deploy/util/DeploySysRun
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: com.sun.deploy.util.DeploySysRun
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
I would appreciate any help.
Thanking you

Categories

Resources