Community
Participate
Working Groups
Created attachment 288242 [details] screenshot for the event details from the error log Since 2022-03 M3, it is no longer possible to launch an Ant script. With M2 in the same workspace it works without problems. With M3 and the release version a window with the following message appears when launching: "A JNI error has occurred, please check your installation" See the attached screenshot for the event details from the error log.
Can you attach a sample Ant script? Do you have Eclipse SDK or other plugins as well?
See also bug 578843.
Created attachment 288243 [details] Ant test script
Created attachment 288244 [details] Eclipse IDE configuration
I have added two attachments with an Ant script and my Eclipse IDE configuration.
It seems that Ant tasks can no longer be run on Java versions older than 11 starting from Eclipse 2022-03 (4.23). I believe this is caused by Bug 572083. Also see my comment on Bug 578843 for some more details: https://bugs.eclipse.org/bugs/show_bug.cgi?id=578843#c6
Correction: Bug 578533 is likely the cause as the change for the bug I referred to above went into 2021-06 and this issue only started to appear in 2022-03.
Sarika, I wonder if Ant launch config should always try to use Java 11+ runtime if it now requires 11 JVM.
(In reply to Andrey Loskutov from comment #8) > Sarika, I wonder if Ant launch config should always try to use Java 11+ > runtime if it now requires 11 JVM. Yes, we need to do something on this. Will check.
*** Bug 578843 has been marked as a duplicate of this bug. ***
(In reply to Andrey Loskutov from comment #8) > Sarika, I wonder if Ant launch config should always try to use Java 11+ > runtime if it now requires 11 JVM. No I would suggest changing the compiler source/target/release to 8 instead of 11 which was chosen in the linked likely cause issue, as ant is only requiring 1.8 itself.
(In reply to Mattias Isegran Bergander from comment #11) > (In reply to Andrey Loskutov from comment #8) > > Sarika, I wonder if Ant launch config should always try to use Java 11+ > > runtime if it now requires 11 JVM. > > No I would suggest changing the compiler source/target/release to 8 instead > of 11 which was chosen in the linked likely cause issue, as ant is only > requiring 1.8 itself. No, that was changed on purpose, because of SecurityManager & co in Java 18+, see bug 575210.
I have the same problem. Mine won't run with Java 11, either. I don't get the JNI error message, but it pretends to run and ends quickly with zero output. As a workaround, I set up a simple batch program that accepts the build target name and runs ant. Here's the batch file that should be in placed in the same directory as your build.xml file. I named mine RunAntTarget.bat: cd C:\location\of\build.xml C:\path\to\apache-ant-n.n.n\bin\ant %1 To use the batch file, create a new External Tool Configuration in the Program section. Give it the name of the target name you intend to run. Set the Location to your RunAntTarget.bat file and add the target name (casing matters) to the Arguments section. To run it, click Run. After running once, it should appear in the External Tool Configuration pull-down. Add as many new External Tool Configurations, one per target you need to run, until this issue is resolved.
Previously we had check for Java 8, now changed it to Java 11. https://github.com/eclipse-platform/eclipse.platform/pull/6
Just to clarify: Now it's no longer possible to run Ant with Java 8 from within Eclipse? That should be a big sticker on the package!
No more Java 8, that's really not good news!
Is this restriction to Java 11 really necessary if Ant is started via a separate JRE?
*** Bug 579515 has been marked as a duplicate of this bug. ***
*** Bug 579540 has been marked as a duplicate of this bug. ***
This is marked as resolved and fixed but I can't see any comments that indicate what was done. The closest is that you must use jre 11, which is not possible for those still using jre 8
There this pull request link in the See Also section (in the upper right): https://github.com/eclipse-platform/eclipse.platform/pull/6 And it links to this commit: https://github.com/eclipse-platform/eclipse.platform/commit/5a8c086442f44719d0edf8af84b177baee0d8a49
So the resolution is to not support Java 8. From the non-committer comments that is the question that we want clarification on. Can we get someone to include that in these bug notes please?
(In reply to Barrie Treloar from comment #22) > So the resolution is to not support Java 8. > > From the non-committer comments that is the question that we want > clarification on. > > Can we get someone to include that in these bug notes please? When Sarika said Previously we had check for Java 8, now changed it to Java 11. https://github.com/eclipse-platform/eclipse.platform/pull/6 it means "Previously we explicitly told the user that they can't launch because they need Java 8 or higher so now, because Ant won't launch for Java < 11, we changed the guard and the message to check for that and will produce an error message just like before but now telling the user they need Java 11 or higher."
(In reply to Ed Merks from comment #23) > because Ant won't launch for Java < 11 Except that statement is not true, Ant itself is still fine with Java 8. You can download the latest ant and run it fine with Java 8, just not using the built in ant/ant-launcher in Eclipse 2022-03.
(In reply to Mattias Isegran Bergander from comment #24) > (In reply to Ed Merks from comment #23) > > because Ant won't launch for Java < 11 > > Except that statement is not true, Ant itself is still fine with Java 8. > > You can download the latest ant and run it fine with Java 8, just not using > the built in ant/ant-launcher in Eclipse 2022-03. I didn't say ant doesn't work for Java 8 anymore, I said it won't launch. Perhaps there would be a way that it would still launch, but https://bugs.eclipse.org/bugs/show_bug.cgi?id=579317#c12 suggests that there is a good reason... (I'm just the messenger.)
Could I add my vote to get a workaround to support launching ANT on JDK 1.8. This bug basically as I read it says that there is no plan to support JDK 1.8 Ant builds on recent eclipse builds.
Workaround. If you need to build a Java 8 project then download Apache Ant and you can configure ant build as a new `program` using downloaded external ant binaries in `External Tools Configuration`. In the Environment tab, you must also set the JAVA_HOME variable to the Java 8 jdk path.
Although this bug targets the fix for 4.24, this problem is still not resolved in 2022-06 (4.24). Specifically, running on Linux: Version: 2022-06 (4.24.0) Build id: 20220609-1112 I've resorted to running Ant from a command line for my Java 8 projects.
Work Around. Run Ant as Java 11. Use Java 8 within the Ant script.
(In reply to Barrie Treloar from comment #29) > Work Around. > > Run Ant as Java 11. > > Use Java 8 within the Ant script. How would you do that within the Ant script?
Yeah I would be interested too how you can manage running ANT in eclipse (I am on 2022-09) with Java 11, but then telling the ANT script to compile all in Java 8. Somehow I can't use the --release option in the project java compiler settings either.
(In reply to Andreas Roerig from comment #30) > (In reply to Barrie Treloar from comment #29) > > Work Around. > > > > Run Ant as Java 11. > > > > Use Java 8 within the Ant script. > > How would you do that within the Ant script? This might work: <target name="compile" depends="copyresources" > <javac bootclasspath="${boot.classpath}" target="8" source="8" srcdir="${dir.buildfile}/src/main/java" includeantruntime="false" destdir="${dir.buildfile}/build/classes" includes="**/*" excludes="**/*.form" > <classpath refid="classpath.base" /> </javac> </target>
It's a problem with Ant's wsimport task as well, not just the javac task. It would be best if the seemingly arbitrary requirement to run Ant in Java 11+ was removed.