Problem with java in crontab


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem with java in crontab
# 1  
Old 09-25-2009
Problem with java in crontab

Hello everybody, I have made a java program which runs when i do :
Code:
java telemesures

But when i want to put it in a cron i do
Code:
/j2sdk1.4.1/bin/java -cp :/web/WEB-INF/classes/Dany4/ telemesures

i have got
Code:
 Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver         at java.net.URLClassLoader$1.run(URLClassLoader.java:198)         at java.security.AccessController.doPrivileged(Native Method)         at java.net.URLClassLoader.findClass(URLClassLoader.java:186)         at java.lang.ClassLoader.loadClass(ClassLoader.java:299)         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)         at java.lang.ClassLoader.loadClass(ClassLoader.java:255)         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)         at java.lang.Class.forName0(Native Method)         at java.lang.Class.forName(Class.java:140)         at telemesures.migration_telemesures(telemesures.java:26)         at telemesures.main(telemesures.java:66)

I don't know why it doesn't run when i do this command. It looks like the impoted packages are not imported... Thanks for help
# 2  
Old 09-25-2009
You need set CLASSPATH before run the java command,
such as:

Code:
export CLASSPATH=$CLASSPATH:ojdbc5.jar ; /j2sdk1.4.1/bin/java -cp :/web/WEB-INF/classes/Dany4/ telemesures

# 3  
Old 09-25-2009
ojdbc5.jar ? I don't know if i have it. I just import java.sql.*, java shouldn't know where is it ?
Code:
export CLASSPATH=$CLASSPATH:/web/WEB-INF/classes/oracle/jdbc/
/j2sdk1.4.1/bin/java -cp :/web/WEB-INF/classes/Dany4/ telemesures

Don't work ...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

crontab - runninf a java script just isn't quite working...

hi gurus. I have a little script that runs java from a certain directory. This script runs fine when run manually but when I try to schedule it, it fails to find the script. little_script.sh.. /<directory of java>/java -classpath... (3 Replies)
Discussion started by: MrCarter
3 Replies

2. Programming

can i have an optimal solution for this java code ? Facing Java heap space problem even at 3GB heaps

My desired output is run: for this 1 for this 2 for this 3 for this 4 for this 5 for this 1,2 1->2 for this 2,3 2->3 for this 3,4 3->4 for this 4,5 4->5 for this 1,2,3 1->2,3 (2 Replies)
Discussion started by: vaibhavkorde
2 Replies

3. UNIX for Dummies Questions & Answers

Crontab problem!

Hi All, i added a sh script to crontab, it run but there is sqlplus expression that generate a spool file(gun.lst). this expression didnt run. Summary, 1- my main script is topl.sh that i added it to Cron via "crontab -e" command 2- There is "sqlplus username/password@serverA @umt.sql"... (6 Replies)
Discussion started by: temhem
6 Replies

4. Linux

crontab problem

Hello, I have this in the crontab 30 2 * * * /bin/sh /home/abc but in the log it looks run below Jan 27 08:30:01 localhost crond: (root) CMD (/bin/sh /home/abc how could this happen? I logged in with root user,I use root user's crontab. Kind Regards (9 Replies)
Discussion started by: sunsail
9 Replies

5. Shell Programming and Scripting

CRONTAB problem

Hi i was working on an Unix server/ While logging out i used to type the command exit and log out. Yesterday when i was logging out i got an message saying "YOU HAVE STOPPED JOBS". i have not done anything other than giving exit. What could the reason the message was displayed. I thought i had... (3 Replies)
Discussion started by: venkidhadha
3 Replies

6. UNIX for Dummies Questions & Answers

Trying to run java file in crontab

Hi. I have a java program that create reports, and I would like to run it at each hour using crontab. The main file is crome.jar located at /WebApps/Crome folder. When I want to execute the program I use the next script (name crome): #!/bin/sh if ; then ... (1 Reply)
Discussion started by: karmariv
1 Replies

7. Shell Programming and Scripting

Crontab Problem

Hi All, I have a crontab entry like this... but it's not runing at all...! 30 0 * * * /health_check/FS.sh > /dev/null it should run everyday midnight 1:30 AM is it the problem with that space b/w script and /dev/null ? (9 Replies)
Discussion started by: bullz26
9 Replies

8. UNIX for Dummies Questions & Answers

Problem with crontab

I'm trying to get crontab to run a script, but to test crontab I tried out a very simple command: `echo bob` here is my crontab file (I edited it by using `crontab -e`): ----------------- #!/bin/sh 23 10 * * * echo bob and at 10:23 every day I get a new message: in /var/mail/a... (3 Replies)
Discussion started by: cleansing_flame
3 Replies

9. UNIX for Dummies Questions & Answers

Problem with Crontab

I have a server running 5.9 and I'm trying to cron in the following. 00 01 * * 7 cd /data/apache/logs && find . -type f -name "access.*" -mtime +1 -print |xargs rm > /dev/null 2>&1 But I keep get the following error.... 00 01 * * 7 cd /data/apache/logs && find . -type f -name "access.*"... (2 Replies)
Discussion started by: Zak
2 Replies

10. UNIX for Dummies Questions & Answers

Problem with Crontab

I have a problem with crontab. I made a class file name Mailer.class. When I run it at command line like this: $ java Mailer It runs very well and I got the email. But If I put it in a crontab line like this: 30 11 * * * java Mailer It doesn't work. Every time the cron job... (5 Replies)
Discussion started by: qhuynh
5 Replies
Login or Register to Ask a Question