![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Java to tuxedo through cron | charu | Shell Programming and Scripting | 4 | 1 Week Ago 11:19 PM |
| call constructor of java class in script | thebladerunner | Shell Programming and Scripting | 1 | 10-21-2008 12:23 PM |
| PHP or Java Class Code Generator 1.1.0 (Default branch) | iBot | Software Releases - RSS News | 0 | 02-08-2008 09:50 AM |
| How to call Java class from ksh | jyotib | Shell Programming and Scripting | 3 | 01-14-2008 11:40 AM |
| S-058: HP-UX Running Java JRE and JDK | iBot | Security Advisories (RSS) | 0 | 12-24-2007 06:40 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Running java class with a cron
Hello everybody,
I have a problem about running a java class with a cron : I have Cron.txt file which has : 0,5,10,15,20,25,30,35,40,45,50,55 * * * * CronJava.txt I have CronJava.txt wihich has : cd ias/j2ee/SapAktarim/applications/SapAktarim/SapAktarim/WEB-INF/classes/;java -classpath $CLASSPATH main.SapAktarim When cron works I get "help of java command" from my mail. if i do it manually, cd to path and type java -classpath $CLASSPATH main.SapAktarim it works without a problem. When I place it in a cron, I get this situation. Maybe cron can't see my user classpath info. When I try a sipmle class which only system.out.println("Hello") it works with the cron ...? I am new on Unix... Helps appreciated... Thanks a lot |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
You might try printing the $CLASSPATH shell variable in your shell script to see if all is OK.
|
|
#3
|
|||
|
|||
|
Hai,
in ur java class ur specfying some thing to print on console but may be there may be no console opened to print ur s.o.println from crontab u can't start application which have GUI interface if u really want to start up like then install screen.rpm and in the crontab before the script calling specify it as 25 * * * * root screen -d -m myclass.java |
|
#4
|
|||
|
|||
|
In CronJava.txt do this:
echo $CLASSPATH > /tmp/cronout Wait a while. While you're waiting, do this: echo $CLASSPATH Compare that to the contents of /tmp/cronout. Are they the same? If not, do this ONCE: echo "#!/bin/sh" > /tmp/tmpfile echo "CLASSPATH=$CLASSPATH" >> /tmp/tmpfile echo "export CLASSPATH" >> /tmp/tmpfile cd /to/directory/where/your/CronJava.txtfile/is cat CronJava.txt >> /tmp/tmpfile # If you get any errors during the above actions, STOP. Try to fix them. Retry commands. If everything looks ok, then, cp /tmp/tmpfile CronJava.txt You should be all set. |
|||
| Google The UNIX and Linux Forums |