Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

class file has wrong version 55.0, should be 53.0 #31

Open
Morsmalleo opened this issue Nov 9, 2021 · 9 comments
Open

class file has wrong version 55.0, should be 53.0 #31

Morsmalleo opened this issue Nov 9, 2021 · 9 comments

Comments

@Morsmalleo
Copy link

Keep getting this error everytime I run ./mvnw clean install, the error arises with both Java 1.8.0_252 and Java 11.0.3 for Kali Linux , done some research and can't seem to find a solution.

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/kali/uber-apk-signer/src/main/java/at/favre/tools/apksigner/ui/MultiKeystoreParser.java:[6,24] cannot access java.util.stream.Collectors
bad class file: /modules/java.base/java/util/stream/Collectors.class
class file has wrong version 55.0, should be 53.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  13.585 s
[INFO] Finished at: 2021-11-09T04:54:32-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project uber-apk-signer: Compilation failure
[ERROR] /home/kali/uber-apk-signer/src/main/java/at/favre/tools/apksigner/ui/MultiKeystoreParser.java:[6,24] cannot access java.util.stream.Collectors
[ERROR]   bad class file: /modules/java.base/java/util/stream/Collectors.class
[ERROR]     class file has wrong version 55.0, should be 53.0
[ERROR]     Please remove or make sure it appears in the correct subdirectory of the classpath.
[ERROR] 
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
@patrickfav
Copy link
Owner

Class file version 53 is Java 9 and version 55 is java 11 - are you sure you set Maven to use the desired java version and not just java home?

Try to run ./mvnw -version to see which java version it uses. Mine is

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\Users\****\.m2\wrapper\dists\apache-maven-3.6.3-bin\1iopthnavndlasol9gbrbg6bf2\apache-maven-3.6.3
Java version: 1.8.0_202, vendor: AdoptOpenJdk, runtime: C:\Program Files\AdoptOpenJDK\jdk-8.0.202.08\jre
Default locale: de_AT, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

and compiles fine.

@Morsmalleo
Copy link
Author

Morsmalleo commented Nov 13, 2021

Ah so that's what the problem could be, I will run the command in the terminal and print the output

@Morsmalleo
Copy link
Author

OK so I ran ./mvnw -version in a terminal and this was the output

Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/kali/.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3
Java version: 11.0.13, vendor: Debian, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.10.0-kali9-amd64", arch: "amd64", family: "unix"

I switched to Java 1.8.0_252 provided by the Debian Stretch software repositories and ran the same command and it gave me the same output.

@LynnLiu301
Copy link

Any solution on this problem? I am running into same thing on my gradle project.

@Morsmalleo
Copy link
Author

Any solution on this problem? I am running into same thing on my gradle project.

Nothing so far bro, been waiting for a while, not sure what's happening

@ShemBrooklyne
Copy link

Any solution on this problem? I am running into same thing on my gradle project.

Nothing so far bro, been waiting for a while, not sure what's happening

I sort of encountered a similar issue today and I have managed to solve it with help from multiple sources from the internet. I learned that the issue is that some class files were compiled using Java X while others were compiled using Java Y.

  1. Your first approach is to confirm the linked Java version of your mvn. mvn -v
  2. Then confirm which Java version you are using for both your computer and application.
  3. If they don't match, feel free to set a JAVA_HOME variable for your desired Java version. echo export "JAVA_HOME=\$(/usr/libexec/java_home -v 17)" >> ~/.bash_profile && source ~/.bash_profile
  4. After that, do a maven build of your application. mvn clean install

@Morsmalleo
Copy link
Author

Morsmalleo commented Oct 13, 2022

Thanks I'll give this a try

@keunoh
Copy link

keunoh commented Dec 14, 2022

Because the library classes that you're using at the moment are decompiled by Java 11, not different verison of Java.
When I check some parent class from some library, it updated by Java version.
I mean classes are changing depends on Java version.
So you need to match library classes that you use and Java version.

@Morsmalleo
Copy link
Author

Because the library classes that you're using at the moment are decompiled by Java 11, not different verison of Java. When I check some parent class from some library, it updated by Java version. I mean classes are changing depends on Java version. So you need to match library classes that you use and Java version.

I didn't think Java 9 had an installation candidate because that's what class file 53 is, it's java 9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants