You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Scott Stirling <sc...@rcn.com> on 2004/08/27 18:00:35 UTC

Shell problems with wild cards and sh vs. cmd

Hi,

We have an old Java 1.1 applet that we need to compile on UNIX and Windows. In
Java 1.4.x targeting compilation for 1.1 byte codes no longer works (thanks,
Sun!), so we seem to need muiltiple JDKs installed to compile this one
particular sub-project, and switch JAVA_HOMEs or something.

But I had another idea, which is to use the 1.1 classes.zip, which contains the
compiler, and call it directly using the <java> task. We have to do this since
Ant detects the compiler and JVM version when we use the <javac> task, and as I
said, with JDK 1.4, both Ant and Sun JVM ensure that you can't target
compilation for 1.1. 

So, we did a <java> target that works on Windows calling the javac class and
passing in a /path/to/*.java. The Windows command shell somehow gets a chance to
evaluate the asterisk and expand it. We understand that this all has to do with
Ant using Runtime.exec() under the covers. Anyway, on UNIX (sh or bash
environment), the '*.java' does not get evaluated. The javac class throws an
error saying it can't find a file named "*.java"

So, turns out I had exactly the same issue using the <java> task to call
weblogic.jspc a while back, and I had to write two targets for it (I didn't use
the optional task for good reasons), one for Windows, which is fast as hell, and
one for other OSes, which is slow. The speed is the difference between looping
over each folder of JSPs with JSPC, vs. processing a whole huge Web app all at once.

Anyway, this is a recurring issue now for me. We've tried using <exec> to call
java to call the javac class. This also does not work (the '*.java' is still
taken as a literal on UNIX). I know we *install* JDK 1.1 on any and all boxes
that need to build this, but it would be so much slicker to just be able to
stick classes.zip in this one project and not have any external deps. Plus, the
issue affects use cases (as described with the weblogic.jspc tool).

Anyone else run into this and come up with a portable solution?

Thanks,
Scott Stirling
Workscape, Inc.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org