Community
Participate
Working Groups
I have a ANT build file that works without errors when startet from a dos box (cmd.exe). But when I run ANT from Eclipse, my "compile" target fails with the following error: ---------- Compiling 25 source files to D:\data\iComps\icf\prg\java\bin\classes D:\data\iComps\icf\prg\java\src\de\icomps\gui\GuiUtils.java:18: cannot access java.lang.Object bad class file: D:\Programme\j2sdk1.4.0_01\jre\lib\rt.jar (java/lang/Object.class) class file has wrong version 48.0, should be 47.0 Please remove or make sure it appears in the correct subdirectory of the classpath. public static void centerFrame(Frame frame) { ^ 1 error Build exception: D:\data\iComps\icf\prg\java\build.xml:61: Compile failed, messages should have been provided. Build exception: D:\data\iComps\icf\prg\java\build.xml:61: Compile failed, messages should have been provided. D:\data\iComps\icf\prg\java\build.xml:61: Compile failed, messages should have been provided. at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:559) at org.apache.tools.ant.Task.perform(Task.java:217) at org.apache.tools.ant.Target.execute(Target.java:184) at org.apache.tools.ant.Target.performTasks(Target.java:202) at org.apache.tools.ant.Project.executeTarget(Project.java:601) at org.apache.tools.ant.Project.executeTargets(Project.java:560) at org.eclipse.ant.internal.core.ant.InternalAntRunner.run (InternalAntRunner.java:262) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.ant.core.AntRunner.run(AntRunner.java:233) at org.eclipse.ui.externaltools.internal.core.AntFileRunner.execute (AntFileRunner.java:59) at org.eclipse.ui.externaltools.internal.core.DefaultRunnerContext.executeRunner (DefaultRunnerContext.java:413) at org.eclipse.ui.externaltools.internal.core.DefaultRunnerContext.run (DefaultRunnerContext.java:464) at org.eclipse.ui.externaltools.internal.ui.AntLaunchWizard$1.run (AntLaunchWizard.java:117) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run (ModalContext.java:98) Build exception: D:\data\iComps\icf\prg\java\build.xml:61: Compile failed, messages should have been provided. ----------- I already played with different JDK settings in Eclispe (1.3, 1.4, with/without 1.3 LIB, ...) but keep getting this error! Does Eclipse support J2SDK 1.4 at all?
Ant in Eclipse works within the same VM that Eclipse was launched on. What VM are you using to launch Eclipse? It appears that you have launched Ecilpse on a 1.3.* vm and are attempting to compile using a 1.4 library.
I also started Eclsipe with eclipse.exe -vm D:\Programme\j2sdk1.4.1_01\bin\java.exe but it produces the same error ...
I can reproduce your problem if I launch eclipse on a 1.3.* vm and then set the javac bootclasspath to use the 1.4.* rt.jar. If I launch eclipse on a 1.4.* vm with the bootclasspath set to use the 1.4.* rt.jar I compile cleanly. Are you setting a bootclasspath? If so does it work if you do not add the rt.jar?
Intend to close this bug report if no further input from bug reporter.
how do i set a bootclasspath? the problem is, that i have several projects that need different JDKs (1.3 and 1.4), so i can't set the JDK globally, I need to set it on a project basis. I thought this would be done within the project classpath/libs ...
As stated before the current Ant support in eclipse works within the same VM that eclipse was launched in. You cannot selective set the JDK level for a project that Ant will use. You can specify the target ("1.3" or "1.4") for your javac task...this is looking more and more like a duplicate of bug 24129.
hm, then it would be locigal to remove the ant properties in preferences and move it to project properties. the ant for this project would then use the classpath of this project or (even better) would have its own classpath/path setting for this project. :-)
I agree that Ant should be configurable at the project level...see bug 15405. *** This bug has been marked as a duplicate of 15405 ***
*** Bug 25817 has been marked as a duplicate of this bug. ***