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

javah requires JVM 11 #44

Closed
rpiotrow opened this issue May 12, 2021 · 8 comments
Closed

javah requires JVM 11 #44

rpiotrow opened this issue May 12, 2021 · 8 comments
Assignees

Comments

@rpiotrow
Copy link

when invoking sbt javah (plugin version 1.4.1) on Java 8 I'm getting below error:

[error] stack trace is suppressed; run last javah for the full output
[error] (javah) java.lang.UnsupportedClassVersionError: ch/jodersky/sbt/jni/javah/JavahTask has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

The same on Java 11 works. Is it possible to compile plugin for 1.8 target?

@pomadchin
Copy link
Member

@rpiotrow I see this err only when I import project via IntelijIDEA, are you sure that's not the scala plugin issue?

@rpiotrow
Copy link
Author

I have checked that on a project just cloned from the repo (so IntelliJ IDEA could not do here anything) and the problem is present.

Repository: https://github.com/CitrineInformatics/ecos-java-scala

Console:

$ git clone git@github.com:CitrineInformatics/ecos-java-scala.git
$ cd ecos-java-scala 
$ java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)
$ sbt
[info] welcome to sbt 1.3.13 (AdoptOpenJDK Java 1.8.0_292)
[info] loading global plugins from /Users/kpalcowski/.sbt/1.0/plugins
[info] loading settings for project ecos-java-scala-build from plugins.sbt ...
[info] loading project definition from /private/tmp/ecos-java-scala/project
[info] Compiling 1 Scala source to /private/tmp/ecos-java-scala/project/target/scala-2.12/sbt-1.0/classes ...
[info] loading settings for project root from build.sbt ...
[info] set current project to ecos (in build file:/private/tmp/ecos-java-scala/)
[info] sbt server started at local:///Users/kpalcowski/.sbt/1.0/server/04a1e2064d1c70fd3e52/sock
sbt:ecos> javah
[info] Compiling 3 Scala sources to /private/tmp/ecos-java-scala/target/scala-2.12/classes ...
[info] Headers will be generated to /private/tmp/ecos-java-scala/src/native/include
[error] stack trace is suppressed; run last javah for the full output
[error] (javah) java.lang.UnsupportedClassVersionError: ch/jodersky/sbt/jni/javah/JavahTask has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
[error] Total time: 5 s, completed May 27, 2021 12:44:37 PM
sbt:ecos> 

@pomadchin
Copy link
Member

pomadchin commented May 27, 2021

@rpiotrow yes that’s what I meant; weird really, how the hell it works than for me

@pomadchin
Copy link
Member

@rpiotrow checkout CI builds here https://github.com/PDAL/java tests pass though it uses jdk8 >_>

@rpiotrow
Copy link
Author

@pomadchin I do not see invocation of sbt javah in https://github.com/PDAL/java/blob/master/.github/workflows/actions.yml. I have cloned that repo and I'm getting the same error:

$ sbt
[info] welcome to sbt 1.4.6 (AdoptOpenJDK Java 1.8.0_292)
[info] loading global plugins from /Users/kpalcowski/.sbt/1.0/plugins
[info] loading settings for project java-build from plugins.sbt ...
[info] loading project definition from /private/tmp/java/project
[info] loading settings for project root from build.sbt ...
[info] set current project to pdal-jni (in build file:/private/tmp/java/)
[info] sbt server started at local:///Users/kpalcowski/.sbt/1.0/server/c4d1948923b70ee90a5b/sock
[info] started sbt server
root > native/javah
[error] stack trace is suppressed; run last native / javah for the full output
[error] (native / javah) java.lang.UnsupportedClassVersionError: ch/jodersky/sbt/jni/javah/JavahTask has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
[error] Total time: 0 s, completed May 27, 2021 5:15:54 PM

@pomadchin
Copy link
Member

pomadchin commented May 27, 2021

@rpiotrow oh im blind; you're right 🤦 I see where is this issue comes from now. Thanks for spending your time to clarfiy it.

@pomadchin
Copy link
Member

The issue should be gone with the fresh release https://github.com/sbt/sbt-jni/releases/tag/v1.5.0, let me know if it still an issue for you!

@shamiek
Copy link

shamiek commented Sep 22, 2022

And don't forget to change from ch.jodersky to com.github.sbt
addSbtPlugin("com.github.sbt" % "sbt-jni" % "1.5.0")

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

No branches or pull requests

3 participants