question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does not work with JDK 8 bsed project

See original GitHub issue

The plugin is built on Java 11, so not possible to use with a project using jdk 8.

Throws exception,

[ERROR] Failed to execute goal se.kth.castor:depclean-maven-plugin:1.1.0:depclean (default) on project idsk-commons-media: Execution default of goal se.kth.castor:depclean-maven-plugin:1.1.0:depclean failed: An API incompatibility was encountered while executing se.kth.castor:depclean-maven-plugin:1.1.0:depclean: java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer;

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
cesarsotovalerocommented, Mar 17, 2021

Minor release is coming soon…

1reaction
amottiercommented, Jan 14, 2021

I get the same issue with version 1.1.1 so I tried to investigate a little bit more.

Error is related probably to usage of java.nio.ByteBuffer in: https://github.com/castor-software/depclean/blob/master/depclean-core/src/main/java/se/kth/depclean/core/analysis/asm/ConstantPoolParser.java

A comment mention a workaround to this issue but is not implemented.

I run javap -verbose ConstantPoolParser on ConstantPoolParser.class packaged in depclean-core-1.1.1.jar and get the following output:

  minor version: 0
  major version: 52

According to https://en.wikipedia.org/wiki/Java_class_file#General_layout this confirm that this is some byte code targeting Java 8 even if META-INF/MANIFEST.MF packaged in depclean-core-1.1.1.jar mention Build-Jdk: 15.0.1: JDK 15 can generate byte code for Java 8.

An explanation about this behavior can be found in https://github.com/eclipse/jetty.project/issues/3244#issuecomment-495322586

Actually current pom.xml specify source and target (https://github.com/castor-software/depclean/blob/master/pom.xml#L19) but if Java 9 or higher is used to build the project it should specify the release option (maven.compiler.release) see https://stackoverflow.com/a/43103038/2440340

I will shortly create a pull request that fix the issue and allow successful build on Java 9 or higher (but note that build will failed with Java 8) with error [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project depclean-core: Fatal error compiling: invalid flag: --release -> [Help 1])

I’m not sure if there is an easy solution to allow build of the project with both Java 8 and Java 9+ versions. I guess that requiring Java 9+ version for building is not a big issue and that compatibility with Java 8+ version is what is important here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compatibility Guide for JDK 8 - Oracle
Java SE 8 is strongly compatible with previous versions of the Java platform. Almost all existing programs should run on Java SE 8...
Read more >
JavaFX troubleshoot: JDK 8 project is not working on JDK 9/10
This video solves the problem of not working JavaFX project which builds on JDK 8.this video also gives the solution to the error:Error: ......
Read more >
Is it possible to select JDK 8 for Java project in Visual Studio ...
Build path specifies execution environment JavaSE-1.8. There are no JREs installed in the workspace that are strictly compatible with this ...
Read more >
Building Java & JVM projects - Gradle User Manual
If you don't have much experience with building JVM-based projects with Gradle, take a look at the Java ... Gradle can only run...
Read more >
Java Versions and Features - Marco Behler
Legacy projects in companies are often stuck with using Java 8 (see ... It obviously does not work the other way around, say...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found