Issue
With eclipse I get the following error when I execute an ant task with Java 1.8.
JRE version less than 11 is not supported.
My "external tool configuration" is configured with "Seperate JRE" Eclipse Adoptium jdk-8.0.352.8-hotspot
Anybody knows how to prevent this restriction?
Eclipse IDE for Enterprise Java and Web Developers (includes Incubating components) Version: 2022-12 (4.26.0) Build id: 20221201-1913
Solution
Got it running.
- I only need the classes to end up with Java 8.
- Ant itself can run with 11 or higher
Adding source and target with 1.8 did the trick for me in build.xml
<JAVAC destdir="${build.classes.test}" source="1.8" target="1.8"> <src path="${src.test}" />
Afterwards I checked with javap -v MyStuff.class
and saw Output major version: 52
which is 1.8
More background
Here are bugs describing the situation:
- https://bugs.eclipse.org/bugs/show_bug.cgi?id=578533
- "A JNI error has occurred, please check your installation" - https://bugs.eclipse.org/bugs/show_bug.cgi?id=579317
- this is the source of the message: https://github.com/eclipse-platform/eclipse.platform/pull/6/commits/89cdd3370482bff681618ca46b6250a0a94b4319
Further issues
java task is not running with 1.8
The above method worked for the the ant
javac
task. But I had also antjava
to generate some classes. I ended up with[java] Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
Because Ant is running with Java 17 and JAXB classes like
javax.xml.bind.JAXBException
are not included in JDK anymore since Java 11.My workaround is to not use Eclipse for these ant tasks but to use a seperate (old=same we use in jenkins build) ant installation and run tasks from command line. See https://ant.apache.org/manual/install.html#getBinary
running ant task with 1.8 leads to
Error: A JNI error has occurred, please check your installation and try again.
- "External Tool Configration" -> "JRE" -> "Seperate JRE" switch jdk8 to 17 (or run in the same JRE as the workspace if you have higher jdk there)
- and because of that this leads to above issues ;-)
Answered By - timguy
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.