Harvey is right and his solution is cleaner than mine (his Ant script is a lot better and easier to understand than the old one, big kudos to him :D).
Look at this line:
https://github.com/hharrison/java3d-core/blob/master/build.xml#L88and use Ant as a build tool instead of reinventing the wheel. There is a reason why we use it.
Just out of curiosity, why do you need to build Java 3D? Maybe we can do something for you.