Eclipse and Ant

Hi,
I posted this on Newless Clewbies…but didn’t get answers… :-/

I’m using Eclipse 2.1. My problem is that the Ant Builder included doesn’t find the java executables, i.e., I cannot use the <rmic … > tag. To solve the problem I’m using <exec …jdk\bin\rmic.exe …>
I didn’t try the others executables (jar, javac) because I 'm using the Ant script after Eclipse’s Java build.
When I try to build the project, I recieve the following error:
[rmic] BUILD FAILED: file:E:/Proyectos/jinitest/build.xml:4: Cannot use SUN rmic, as it is not available. A common solution is to set the environment variable JAVA_HOME or CLASSPATH.

I don’t know if it’s a problem of Eclipse(config or installation) or my Java installation… (currently using j2sdk1.4.0 on Win98SE)

Anyone knows where to configure correctly Ant in Eclipse??

what happens when you open a dos prompt and type “echo %JAVA_HOME%”?

If nothing, open up autoexec.bat and add

set JAVA_HOME=C:\path\to\java

the path being the root home of Java, something like C:\j2sdk1.4.0

near the top, there may be other “set” statements, place it by them.

Reboot your computer and see if that helps.

I tried that, my autoexec has the lines:
set JAVA_HOME=c:\jdk set PATH=c:\jdk\bin;....

Both doesn’t fix the problem.

Go to window-> preferences. Select the Ant section, runtime is under ant. Set ANT_HOME here.

??? What do I put there ???
It ask for a directory with a lib directory inside…
Since Ant came with eclipse, I looked in the plugins directory, and found this…
C:\eclipse\plugins\org.eclipse.ant.core_2.1.0 C:\eclipse\plugins\org.apache.ant_1.5.2
The first one has a lib directory inside… tried setting it but still doesn’t work… :’(

I downloaded and installed ant from jakarta, then pointed to this in eclipse. Never tried eclipses own ant.

Still doesn’t work… :-/
Following your tip, I downloaded Ant (1.5.3) and pointed in the ANT_HOME field in the preferences…
I also changed my autoexec to try Ant from the command line. Now it looks like:
set JAVA_HOME=c:\jdk set ANT_HOME=c:\ant set PATH=c:\jdk\bin;c:\ant\bin; ....
Next tested Ant from the command line and worked ok :).
But in eclipse appears an error:
BUILD FAILED: java.lang.VerifyError: (class: org/apache/xerces/parsers/IntegratedParserConfiguration, method: configurePipeline signature: ()V) Incompatible type for getting or setting field
I don’t want to open a D.O.S. window each time I need to rebuild my project… >:(

What could be the error now? ??? ???

I don’t suppose that you looked at the Eclipse newsgroups. For example,

http://dev.eclipse.org/newslists/news.eclipse.tools/msg15225.html

Make sure that you have a username / password for the newsgroups as seen here:

http://www.eclipse.org/newsgroups/index.html

Typically if you have problems with a third party tool the best place to get answers about that tool is forums, newsgroups, mailing lists, etc for that tool.

Thanks!!
It worked!!
:slight_smile: :slight_smile:

BTW, in the thread they were looking for another error, but the fix also worked for me!!

Did I thank??
:slight_smile: