native
native copied to clipboard
[jnigen] Document what version of Java to use and how to use the right one.
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
Exception in thread "main" java.lang.RuntimeException: java.lang.IllegalArgumentException: Unsupported class file major version 65
at com.github.dart_lang.jnigen.apisummarizer.util.ExceptionUtil.wrapCheckedException(ExceptionUtil.java:22)
at com.github.dart_lang.jnigen.apisummarizer.disasm.AsmSummarizer.run(AsmSummarizer.java:21)
at com.github.dart_lang.jnigen.apisummarizer.Main.main(Main.java:129)
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 65
at org.objectweb.asm.ClassReader.<init>(ClassReader.java:199)
at org.objectweb.asm.ClassReader.<init>(ClassReader.java:180)
at org.objectweb.asm.ClassReader.<init>(ClassReader.java:166)
at org.objectweb.asm.ClassReader.<init>(ClassReader.java:287)
at com.github.dart_lang.jnigen.apisummarizer.util.ExceptionUtil.wrapCheckedException(ExceptionUtil.java:20)
... 2 more
Fatal: Cannot generate summary: FormatException: Unexpected end of input (at character 1)
Maybe we can parse exceptions throw in the summarizer, and tell users what to do. (I'm assuming something is wrong with my Java version here.)
And on another machine:
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
Exception in thread "main" java.lang.RuntimeException: java.lang.IllegalArgumentException: Unsupported class file major version 66
at com.github.dart_lang.jnigen.apisummarizer.util.ExceptionUtil.wrapCheckedException(ExceptionUtil.java:22)
at com.github.dart_lang.jnigen.apisummarizer.disasm.AsmSummarizer.run(AsmSummarizer.java:21)
at com.github.dart_lang.jnigen.apisummarizer.Main.main(Main.java:129)
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 66
at org.objectweb.asm.ClassReader.<init>(ClassReader.java:199)
at org.objectweb.asm.ClassReader.<init>(ClassReader.java:180)
at org.objectweb.asm.ClassReader.<init>(ClassReader.java:166)
at org.objectweb.asm.ClassReader.<init>(ClassReader.java:287)
at com.github.dart_lang.jnigen.apisummarizer.util.ExceptionUtil.wrapCheckedException(ExceptionUtil.java:20)
... 2 more
Fatal: Cannot generate summary: FormatException: Unexpected end of input (at character 1)
- https://github.com/dart-lang/native/issues/627
This is closed, but users have to find this issue.
The summarizer itself is already compiled to the right version
pkgs/jnigen/java/pom.xml
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
But our javac invocations in the tests do not specify a target. https://stackoverflow.com/questions/11364761/how-do-i-compile-a-java-with-support-for-older-versions-of-java#comment84680930_11364761
We specify the versions here: https://github.com/dart-lang/native/tree/main/pkgs/jnigen#java-tooling