Hi, I have a script which is excuted through a 'cron', in which I run a java program. But the program is not running in the cron. Is there any thing which we need to use to execute a JAVA program in a cron. Regards Vishnu
Hi Vishnu Can you please provide your script or something to see how you are running the java program from the script? Also, please explain- how do you know that your java program is not running? Regards Maulin
cd /expbackup/ismspay/franchise/pihextraction while : do java Payment #Checking whether the file has any record at all wc -l PIH_*.csv > a i=`cut -c 1 a` echo $i if [ $i -ne 0 ] then cp PIH_*.csv /expbackup/ismspay/franchise/pihextraction/payready/. cp PIH_*.log /expbackup/ismspay/franchise/pihextraction/paylog/. rm -f PIH_*.csv rm -f PIH_*.log sh payftp.sh mv /expbackup/ismspay/franchise/pihextraction/payready/PIH_*.csv /expbackup/ismspay/franchise/pihextraction/paydone/. rm a else rm -f PIH_*.csv rm -f PIH_*.log rm a fi sleep 300 done
I find it not running because the action it is supposed to do is not being done. Is there any other way to monitor please let me know. Regards Vishnu
Hi Vishnu Rule 1 about crontab: your path is not the same as if you had signed in. So in all probability your script does not know where the java executable is. You can set the path, either in the script, or in the crontab entry (depending on the OS). However if this script is being run by root or a priveledged user, then this may open a security risk. The recommended way in Unix is to specify the full path to the executable. Try typing 'which java' at the command prompt, to see exactly where your java executable is. Then put that full path into your script. Regards, Andrew
Yes. I agree with Andrew. Though I have never written a cron job myself Try writing full path to java exe and see if it works. Also, if I were you I would try writing a little separate program first instead testing on the real application. Regards Maulin
Vishnu Vardhan A N V
Greenhorn
Joined: Jul 25, 2003
Posts: 5
posted
0
I have done what you had said and modified my script as follows. #Executing the payment extraction program export SHLIB_PATH=/oracle/app/oracle/product/8.1.7/lib export LD_LIBRARY_PATH=/oracle/app/oracle/product/8.1.7/lib JAVA_HOME=/opt/java1.2 CLASSPATH="$JAVA_HOME"/lib/tools.jar:/oracle/app/oracle/product/8.1.7/jdbc/lib/classes12.zip export JAVA_HOME CLASSPATH export ORACLE_HOME=/oracle/app/oracle/product/8.1.7 cd /expbackup/ismspay/franchise/pihextraction echo $JAVA_HOME echo $CLASSPATH $JAVA_HOME/bin/java Vishnu ~ But even now when I run the script I am getting the following error Exception in thread "main" java.lang.NoClassDefFoundError: Vishnu But when I run the same class file in the command prompt, I am able to execute the same.
Originally posted by Vishnu Vardhan A N V: I have done what you had said and modified my script as follows. #Executing the payment extraction program JAVA_HOME=/opt/java1.2 CLASSPATH="$JAVA_HOME"/lib/tools.jar:/oracle/app/oracle/product/8.1.7/jdbc/lib/classes12.zip export JAVA_HOME CLASSPATH
It looks like you have added tools.jar and oracle's classes to you CLASSPATH, but not the location of Vishnu.class. If you add that directory to your classpath it will probably work.