Problems Executing Java From Cron

Today I searched on a path problem when executing a Java program from Cron. The sh script I was executing ran fine when executing in the shell, but hibernate was failing its startup. It turns out that it was not using the correct version of Java. The path export that normally fires when a user shells in was not present when Cron fired the job.

The solution: export the path and append the path to the correct Java version in the shell script.

export PATH=/jdk1.6.0_16/bin:$PATH

Only took about 30 minutes to figure that out…uggg

Go back to top