i setup a crontab job to run a php script, php ~/Documents/workspace/tools/src/main/php/testcron.php > mylog
and the log file shows: JAVA_HOME is not set.
i tried export and saw JAVA_HOME="/Library/Java/Home"
i changed it to JAVA_HOME="/usr/bin" but if i open other terminal it still showed as 'Library/Java/Home' and also it complain cannot find java_home if i run php script in the same terminal that i changed the JAVA_HOME, anyone know what's wrong? thanks. im using Mac
you should specify your JAVA_HOME at the beginning of the PHP script or in your cron definition like this : * * * * * * export JAVA_HOME=/usr/bin;~/Documents/workspace/tools/src/main/php/testcron.php > mylog
You'd better set your environnement variables in a persistent manner. I'm not used to Mac, so I can't tell you the way to do it, but in Linux, you can set it in config files of shell commands like ~/.bashrc
or ~/.zshrc