March 15th, 2002, 03:49 PM
crontab of script doesn't work but manual does
I'm trying to run a Perl script via crontab that produces the following crontab error:
"Exception in thread "main" java.lang.NoClassDefFoundError: Convert"
This Perl script has the following:
"system ("/usr/bin/java Convert midwest_callout.csv \"Midwest Callout\" /s:,");"
This script runs via a shell session with no problems what-so-ever. It's rather a pain in the neck to run it every morning though so I want to be able to cron it.
Here's what my Sys Admin says:
"Suspect it has to do something with environmental variables that are auto-set when you shell into the box, or something to that effect."
Does he have a point? How can I set this up correctly within the script so that the java error is not passed back to the crontab?
Thanks for any ideas or leads on this problem. As I said, it works fine and I've been doing it manually via shell access for the past several weeks but I'm tired of doing so. Plus, I want to take a vacation and know that this will be working by itself ;-)
March 16th, 2002, 03:26 AM
Hey genius, this is the JAVA SERVLETS & JSP FORUM!
March 16th, 2002, 08:55 AM
So where should I post this? The error states: "Exception in thread "main" java.lang.NoClassDefFoundError: Convert" That being java I figured this would be the place to post.
Thanks for your previous, highly informative reply.
March 16th, 2002, 12:18 PM
So why you wrote "Perl script"?
If it calls a java program, why don't you show us how it is done, and what that program is?
March 16th, 2002, 11:44 PM
Have you tried putting the explicit paths to your Convert program and other files in the perl script:
"system ("/usr/bin/java /path/to/Convert /path/to/midwest_callout.csv \"Midwest Callout\" /s:,");"
On second thoughts, you might also need to set your CLASSPATH environment variable properly. This can be passed via the command line or you can possibly run an export command before calling your program (by using a ; to separate the two commands)as in
system("export CLASSPATH=paths;/usr/bin/java Convert ... rest of command line");