Linux Archive

Linux Archive (
-   Fedora Development Java (
-   -   Ant launcher script (

Andrew Hughes 03-20-2012 10:05 AM

Ant launcher script

We've had IcedTea8 failing for some time on our Fedora build machine:

JAVA_HOME=/notnfs/nighttester/icedtea8-target-testing/bootstrap/jdk1.6.0'/notnfs/nighttester/icedtea8-target-testing/' /usr/bin/ant -diagnostics > /notnfs/nighttester/icedtea8-target-testing/ ;
JAVA_HOME=/notnfs/nighttester/icedtea8-target-testing/bootstrap/jdk1.6.0'/notnfs/nighttester/icedtea8-target-testing/' /usr/bin/ant -version >> /notnfs/nighttester/icedtea8-target-testing/
Error: Could not find or load main class
Error: Could not find or load main class
make[3]: *** [/notnfs/nighttester/icedtea8-target-testing/] Error 1

while it succeeds fine for me locally. I've finally managed to have a quick look at
why this is, motivated by the fact that the 6 builds also broke when we upgraded to F16
(though for a different reason).

It seems the Ant script calls /usr/bin/build-classpath by default which in turn runs
/usr/share/java-utils/java-functions. It is set_jvm_dirs in this which fails as it
can't find /usr/share/java-1.8.0:

$ JAVA_HOME=/notnfs/nighttester/icedtea8-target-testing/bootstrap/jdk1.6.0'/notnfs/nighttester/icedtea8-target-testing/' /usr/bin/ant --execdebug -diagnostics
exec "/notnfs/nighttester/icedtea8-target-testing/bootstrap/jdk1.6.0/bin/java" -classpath "/usr/bin/build-classpath: error: JAVAVER_LIBDIR /usr/share/java-1.8.0 does not exist or is not a directory:/notnfs/nighttester/icedtea8-target-testing/bootstrap/jdk1.6.0/lib/tools.jar" -Dant.home="/usr/share/ant" -Dant.library.dir="/usr/share/ant/lib" -cp "" "-diagnostics"
Error: Could not find or load main class

Obviously this doesn't yet exist as there is no system 1.8 install. I don't see
why this is worth causing an error and dropping out of the script. Indeed, if
the following lines are commented out:

# elif [ ! -d "$JAVAVER_LIBDIR" ]; then
# echo "$0: error: JAVAVER_LIBDIR $JAVAVER_LIBDIR does not exist or is not a directory"
# return 1
# elif [ ! -d "$JAVAVER_JNIDIR" ]; then
# echo "$0: error: JAVAVER_JNIDIR $JAVAVER_JNIDIR does not exist or is not a directory"
# return 1

the script works fine and produces the same classpath as for 1.6 or 1.7:

JAVA_HOME=/notnfs/nighttester/icedtea8-target-testing/bootstrap/jdk1.6.0 build-classpath ant ant-launcher jaxp_parser_impl xml-commons-apis

So /usr/share/java-${ver} isn't used anyway. java-1.5.0, java-1.6.0 and java-1.7.0 all exist
but are empty.

Given the script will allow the user to set JAVA_HOME, and this can be to a version < 1.5 or > 1.7,
I see no reason why it shouldn't just silently ignore the path if it doesn't exist, rather than
erroring out.

It's possible to workaround this by passing --noconfig to /usr/bin/ant and setting ANT_HOME, but
I don't know what effect this will have on the numerous other ant scripts on other distributions,
not to mention how we work out what to set ANT_HOME to in the first place. Fixing this script
on the problem distro (Fedora) seems like a much simpler solution.

Would this be possible?
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (

PGP Key: 248BDC07 (
Fingerprint = EC5A 1F5E C0AD 1D15 8F1F 8F91 3B96 A578 248B DC07

java-devel mailing list

All times are GMT. The time now is 08:46 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.