#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    WI
    Posts
    0
    Rep Power
    0

    Question 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 ;-)

    Chris
  2. #2
  3. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    539
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    WI
    Posts
    0
    Rep Power
    0

    Genius


    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.

    Chris
  6. #4
  7. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    539
  8. #5
  9. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,643
    Rep Power
    4247
    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:,");"

    [edit]
    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");
    [/edit]

IMN logo majestic logo threadwatch logo seochat tools logo