First I have installed ant and java and ant can build success in terminal.
Then my work need to start a cron job, to check a build queue every minutes and the run ant build.
So I create a build.sh file, code like this:
#run ant on build path
ANT_CMD=/opt/apache-ant/bin/ant
JAVA_HOME=/opt/jdk1.6.0_03/
cd /mnt/tmp/webview/
$ANT_CMD -f /mnt/tmp/webview/build.xml > /mnt/tmp/$$out.log > /mnt/tmp/$$err.log
And I use sudo crontab -e start an cron like this:
*/1 * * * * bash /mnt/tmp/build.sh
Last I got info on the err.log file like this:
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64/lib/tools.jar
Buildfile: /mnt/tmp/webview/build.xml
init:
[echo] Initializing all output directories...
[delete] Deleting directory /mnt/tmp/webview/bin
[mkdir] Created dir: /mnt/tmp/webview/bin
gen-R:
[echo] Generating R.java from the resources...
I use find / -name tools.jar can be found on /opt/jdk1.6.0_03/lib/tools.jar
My thought is in the bash file ant don't know the JAVA_HOME I'm set.
Does anyone know about this, pls help me!