NoSuchMethodException with PageFactory in Appium - appium

While using some code like the following:
PageFactory.initElements(AppiumFieldDecorator(driver, Duration.ofSeconds(3)), this)
I receive this error:
java.lang.RuntimeException: java.lang.NoSuchMethodException: jdk.proxy2.$Proxy9.proxyClassLookup()
You can read the complete error log here.
I found someone else who had this problem, and the only answer is to use JDK 15 instead of JDK 16. I tried, with JDK 15.0.2 and JDK 1.8, but it doesn't solve the problem for me. In addition I would like to continue using JDK 16.
I'm currently using OpenJDK 16.0.2 and Appium 7.5.1.
Do you know how can I solve it?

I tried again with JDK 15.0.2, and it works now: unfortunately I don't know exactly why.
The following is the init I used in my class:
PageFactory.initElements(AppiumFieldDecorator(driver), this)

I fixed this situation by changing from Java SE 17.0.1 to Java SE 11.0.12
screenshot from Eclipse IDE

Related

Javac throwing unsupported error while Eclipse works fine

I tried to use cmd prompt to execute my java file but I got this error that says
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: MovingObject has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0
but when I tried executing my java file on eclipse it works perfectly fine, its just that I want to try and run it to the command prompt to see if both ways works. Tried searching about the problem but most of the other problems is way back from long ago.
The problem was that my computer was confused as to what JRE to use. I have manually installed JDK and JRE 8 before.
So when I tried checking it through cmd.
javac -version is Java 16
while, java -version is Java 8
So, I uninstalled my Java 8 since I have installed JDK 16 and JRE version 16 on my eclipse which confuses my computer as to what version to use. That's pretty much it.

unable to locate the java compiler com.sun.tools.javac.Main, please change your classloader settings

The following error is occurring while compiling my grails application. I'm using jdk-7u79-windows-x64, I already added the location 'C:\Program Files\Java\jdk1.7.0_79\bin' to my path in Environment Variables. But still the probem exist. My OS is windows 10 (64 bit) and I'm using ggts-3.6.4 (64 bit)
Could anyone tell me why this is happening?
.Error
|
Compilation error: startup failed:
General error during semantic analysis: unable to locate the java compiler com.sun.tools.javac.Main, please change your classloader settings
java.lang.ClassNotFoundException: unable to locate the java compiler com.sun.tools.javac.Main, please change your classloader settings
at org.codehaus.groovy.tools.javac.JavacJavaCompiler.findJavac(JavacJavaCompiler.java:190)
at org.codehaus.groovy.tools.javac.JavacJavaCompiler.compile(JavacJavaCompiler.java:49)
at org.codehaus.groovy.tools.javac.JavaAwareCompilationUnit.gotoPhase(JavaAwareCompilationUnit.java:102)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:548)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:517)
at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:59)
at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:215)
at org.codehaus.groovy.ant.Groovyc.runCompiler(Groovyc.java:1161)
at org.codehaus.groovy.ant.Groovyc.compile(Groovyc.java:1212)
The Groovy-Grails Tool Suite is no longer supported software. I recommend using IntelliJ IDEA instead. See my answer to this question for more details: https://stackoverflow.com/a/38938933/2970843.
First make sure that you have set the path correctly(I had some problems with that).
Also use the java -version command in cmd to see if you are using the same jdk you've set or not
I had set the JAVA_HOME correctly but I had 2 other versions of jdk and the newest was shown as java version,so I deleted them and my problem was solved,hope this workes for you

Grails classpath issue

I have a problem when trying to compile a project using "grails compile". I get the following error:
| Configuring classpath
| Error Error executing script Compile: startup failed:
_GrailsClasspath_groovy: 17: unable to resolve class
org.codehaus.groovy.grails.compiler.GrailsProjectCompiler
# line 17, column 1.
I am very new with groovy/grails, but I assume this is a problem with some classpath somewhere. However, I can't find any file containing the string "GrailsProjectCompiler" in my project. I tried searching google and stackoverflow for similar problems, but the only one I found (http://grails.1312388.n4.nabble.com/Unable-to-resolve-class-org-codehaus-groovy-grails-compiler-GrailsProjectCompiler-td4641043.html) did not work for me.
Does any one have any suggestions as to what could be wrong?
Edit: Grails is version 2.3, this is Mac OS X El Capitan running JDK 1.8
As mentioned in question: Does Grails 2.3.x Support JDK 8
Support for Java 8 had been added since Grails 2.4.
Try JAVA 1.7

Emma does not recognize [ctl] command in Java7

I am using the latest version of Emma i.e. 2.0.5312 and Java 7.
If I run the following command to get the coverage.ec on the fly, I get an error.
java emma ctl -connect localhost:47653 -command coverage.get,coverage.ec
*Exception in thread "main" java.lang.IllegalArgumentException: unknown command:
[ctl]
at com.vladium.emma.Command.create(Command.java:51)
at emma.main(emma.java:39)*
This error is usually seen if an older version of Emma is used but I believe build 5312 is the latest build of Emma. Also, this error is not seen in Java 6.
Has someone come across this issue and been able to resolve it? Any pointers will be very much appreciated.
The latest and last version of Emma is 2.1.5320. I downloaded this version and was able to overcome the above mentioned error.

Execution of Java program

After searching all over the web, I am not able to solve my problem of Java execution. When using command prompt to run my "first" Java program, I am faced with the errors of Unsupported class version and Main class not found. Program will exit.
I have 2 versions of Java on my PC, Java 6 and 7. I have set the path of the JDK 7 in path environment variables and classpath too. I know the problem: I have javac -version as 1.7.02 and java version as 1.6.02, but how to change it and fix the problem?
Please elaborate the problem in easy and understandable language!
You have to run your program with the same or higher version of java that yxou compiled it with.
So you can either compile your program with Java 6 on your PC or run it with java 7.
To run your program with java 7 just use the complete path to your java runtime environment. for instance
c:\jdk7\bin\jawaw.exe yourprogram
How to tell your system which Java version to use is explained here:
Why does java -version returns old version?
JRE [java command] come with your JDK 1.7, and you must change your JAVA_HOME variable to your JDK 1.7 folder.for this work read this article

Resources