0

I'm having problems building my project, using an Ant script, from the command prompt using Ant itself.

It can't find a certain import for a particular Java file in my project (which has nearly 5,000 source files as it is). The import is included in a .jar package whose location I have set in the Ant file itself. (As a pathelement, along with other needed JARs that either are fine, or haven't tried to been used when the crash occurs). The crash happens with javac, with the simple message of "import etc.ect.* cannot be found at line etc"

Oddly enough, I can build the project just fine from the Ant file using an IDE like Eclipse. Any ideas what could be wrong? Thanks!

Monster
  • 1,573
  • 6
  • 23
  • 35

3 Answers3

2

Wow, the solution was completely unrelated. It was a dumb fault in the java code where the class was trying to import .* from a directory that only had folders in it. For some reason, Eclipse didn't seem to mind, but javac did!

Monster
  • 1,573
  • 6
  • 23
  • 35
0

Eclipse's root classloader contains a lot of classes, when you run ant from console there's much less.

Just tell javac task to use the required .jar, and you'll be fine.

alamar
  • 18,729
  • 4
  • 64
  • 97
  • The Jar needed is an external Jar unrelated to eclipse, which I have specified as a path element, along with a number of other external Jars I'm using. – Monster May 18 '09 at 16:10
0

You should post the stack trace, does it say "import required by ..."? ( I forget the exact text). Likely there's a jar that's available in your eclipse environment that is not included in your ant script. Look in the stack trace for the missing class to identify the jar that's not being included in your build.

Steve B.
  • 55,454
  • 12
  • 93
  • 132
  • As I said to the above, it's an external Jar. A source file is using an import carried by that particular Jar file, and for some reason, it can't find it (the location the import points to, not the jar). – Monster May 18 '09 at 16:11