Can we see your build.xml?  Sounds like a classpath/srcpath issue...

On Tue, 22 Mar 2011, 汪燕青 wrote:


Hi everyone,

 

When I’m building a simple project with ANT 1.8.2, I encountered a compiling 
error at the import statement of the java code file.

There only 2 java files: A.java and com/B.java.

A.java is in the root dir of the source directory, it has a public static 
method test() that B.java will call;

         B.java is in the package com, it calls A.test() from inside, with 
‘import A;’ at the beginning following ‘package com;’.

 

         When I wrote a build.xml and added a <javac> task in it to compile the 
java codes, there appeared a compiling error at the
‘import’ statement ---- ‘.’ needed ---- seems that can’t import the class at 
the root of the source directory in JAVA.

         But it runs well when I put the codes in Eclipse. And I tried all the 
attributes of the javac task but still didn’t work. I don’t
know why.

 

    Anyone faced the similar problem? How did you solve this?

    Any suggestions would be highly appreciated!

 

 

 

The Eclipse project’s Java compiler setting is like this:

cid:image001.png@01CBE808.BD0895F0

 

And I set the javac task’s source=”1.3” and target=”1.1”:

<javac source="1.3" target="1.1" srcdir="src"  destdir="class"/>

Will get the same error.

 

 




--
Scot P. Floess             RHCT  (Certificate Number 605010084735240)
Chief Architect FlossWare  http://sourceforge.net/projects/flossware
                           http://flossware.sourceforge.net
                           https://github.com/organizations/FlossWare
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to