java - schedule a job in unix by crontab -
I have created a simple Java program for "Hello World" printing. Code is as follows
public square hello {public static zero main (string [] args) {System.out.println ("hello world!"); }} The class has already been compiled and it is in the same directory. In the same directory I have created a shell file named temp.sh, in which command
java hello Now if I execute this shell file If Java program is being successfully executed I have written a chrono to execute it every minute
* * * * * / home / ashutosh / documents / javaprice / temp Sh & gt; & Gt; /var/log/myjob.log 2 & gt; & Amp; 1 is now showing in my logs
main class could not load Java not me Know what the problem is, I tried giving the full path of the Java file but nothing helped but help me.
Thank you
Your problem is that the working directory of the kronobose is not that directory Where your class lives. Therefore, in the script, add the cd the_right_directory or java -cp some_directory Hello Change
Comments
Post a Comment