How execute java program through crontab in linux

i have written in crontab like
* * * * * cd /usr/java/jdk1.5.0/bin;pwd;echo $PATH; ./test2.sh 2>logjava1
test2.sh contains
java samle
in logjava1 the error is java :command not found
Please help me .this is not working

Is . in your path?
I'd add the JDK Bin folder into your path

Similar Messages

  • Problems of running java program by crontab in Linux

    I have a java application program which runs great when started in command line, or in shell script, or Perl. However, when it is started by crontab in Linux, it stops in the middle when images are to be generated. I guess there might be some settings I need to handle in order to run this java application by crontab. We tried to start the shell script or Perl program in which the java program was invoked, but still didn't work.
    This may be a littler stretching. Does anyone have similar experience and success?
    Thanks in advance.
    ljiang006

    Dear dpz,
    We have used JComponents. Here's the error message I got. Could you further suggest what to do in my crobtap (which is "11 14 * * * java -classpath /home/VeggieB VHpack.VegHealthFrac" ). Looking forward to your reply. Thanks. ljiang006.
    Generate data and image products ...
    Save calibrated (unsmoothed) NDVI and T into Product/NDT/
    Save initial early products into Product/Initial/
    Save temporary products into Product/Tempo/
    Save final update products into Product/Final/
    Save calibrated (unsmoothed) NDVI and T into: Product/NDT/ Exception in thread "main" java.lang.NoClassDefFoundError
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:130)
         at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
         at sun.awt.motif.MToolkit.<clinit>(MToolkit.java:70)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:130)
         at java.awt.Toolkit$2.run(Toolkit.java:712)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:703)
         at java.awt.Component.getToolkitImpl(Component.java:826)
         at java.awt.Component.getToolkit(Component.java:810)
         at java.awt.Component.createImage(Component.java:2564)
         at VHpack.ImageGenerator.createDataImage(ImageGenerator.java:395)
         at VHpack.ImageGenerator.makeImage(ImageGenerator.java:288)
         at VHpack.ImageGenerator.saveImage(ImageGenerator.java:162)
         at VHpack.LVItoProduct.SaveProduct(LVItoProduct.java:146)
         at VHpack.LVItoProduct.generateProducts(LVItoProduct.java:61)
         at VHpack.NoGuiVeg.<init>(NoGuiVeg.java:94)
         at VHpack.VegHealthFrac.main(VegHealthFrac.java:34)

  • How to request Administrator or root to execute java programs?

    How to request Administrator or root to execute java programs when the user is not enough permission?
    as same as following image:
    Windows : http://img151.imageshack.us/img151/6113/winrw5.gif
    Linux: http://img374.imageshack.us/img374/8990/linuxsj4.png
    Edited by: lauangus on 2008?10?13? ??9:15

    Dear Sys Admin,
    Would you please grant me and my group enough rights to do the tasks that have been assigned to us, we are using the following programs. They will need to asccess....
    Sincerely,
    lauangus
    Note: this will usually have to be accompanied by appropriate supervisor signatures and endorsements.

  • How can java programs execute automatically when it connects to network

    Good Day dears...
    How can java programs execute automatically when it connects to network.
    Thanks in Advance friends Shackir

    884924 wrote:
    Good Day dears...
    How can java programs execute automatically when it connects to network.What is "it"? That is, execute when what connects to the network?
    Your computer? If that's what you mean, this is not a Java question. It's an OS operational/administrative question. Executing any program, whether written in Java or not, based on some system event has to do with that system, not with the program. If it's possible to do this, you'd do it exactly the same way for a Java program as you would for any other program.
    Or is "it" the program itself? If this is what you mean, then it's a nonsensical question. For the program to connect to the network and detect that it has connected to the network, it must already be executing, so asking how to execute it at that point is meaningless.
    Finally, I'll point out that "connecting to the network" is a pretty meaningless phrase. Or rather, it has so many potentially valid meanings that it's impossible to know which one you're referring to when you use that phrase. And I'd be willing to bet you don't have a clear picture of that yourself.

  • How to execute java programs in xcode

    I cannot execute Java program in XCode for Mountain Lion 10.8.2. Please help me how to execute a Java program.

    Do you have a particular error or message or diagnostic or issue, or something that's particularly wrong with Xcode?  If installed, Java does work, and Java applications can be invoked.
    Background: Java was deprecated from OS X a while back, and Java itself was removed from the default OS X 10.8 installation.
    Given that Java is now an add-on for OS X, you'll want to check with Oracle — the owner of Java — for OS X kits and tools.
    I don't know off-hand if Xcode still particularly supports Java (it was pretty weak, when last I checked), but I'd expect you'll be using makefiles for the work, and I'd also suspect that whatever Java support remains in Xcode will probably be going away in some future version of Xcode.   (If support hasn't already disappeared.  You may be using bash build scripts and makefiles to deal with Java now, or going forward.)
    If you don't have access to the Apple developer forums and the discussions of tools available there, then the archives of the Apple Java-Dev mailing list can be a good spot to look for existing discussions, and to post questions related to Java development on OS X.
    As for IDEs other than Xcode,  Eclipse or NetBeans or IntelliJ IDEA, and BlueJ all run on OS X, and any of these would probably be a better long-term choices for Java development on OS X.

  • Running a Java program at startup in Linux

    Hello
    How do I run a Java program at startup in Linux? I know in Windows I can put a .bat file in C:\Windows\Start Menu\Programs\StartUp\ directory, but in Linux I have no idea how it is done.
    Thank you,
    Mihai

    This is really a Linux question, not Java.
    And then it depends on the version of Linux you are using.
    Maybe this will help, otherwise you should try on a forum for your version of Linux.

  • Execute Java Program in a specific time everyday

    Hi All,
    I need help for Execute Java Program in a specific time everyday.
    I want to do insert data into database every 3:00 AM everyday.
    I thought there is a one thread program will do. It is correct my understanding? Please let me know and guide me How can I do?
    Thanks
    Amit

    If you are using Window$ then you can create a bat file to execute the program and place the bat file in Scheduled Tasks.

  • How execute java project in DOS6.22 ?

    How execute java project in Dos6.22 ?
    if it possible
    thanks,
    Betzalel

    You might have problems with file name like *.java and *.class.
    As if I had heard about some JVM for 16-bit Windows (the next best thing to DOS ;-) written by IBM.

  • Running Java programs through a GUI

    Hi All.
    I have a Java GUI which compiles and runs other Java programs through the use of JButtons.
    The user clicks one button to compile and another to run. Compile is running fine but Run is slightly odd.
    When I click the Run button the Java program does not run until I minimize the GUI or switch to another window or application.
    So for example I click the Run button, nothing happens, I then alt+tab or minimize to say NetBeans (which I am using to develop it) or an IE window. The program then runs successfully
    My method for running the program is:
    public void clickRunProgram() {
            try {
                Runtime r = Runtime.getRuntime();
                r.exec("cmd /c java Testing");
            catch (IOException ex) {
                Logger.getLogger(ProgrammingEnvironmentGUI.class.getName()).log(Level.SEVERE, null, ex);
        }Any ideas?
    Cheers.
    Edited by: lobrien9 on 25-Mar-2008 12:57

    You must give the process its input and get its output or it won't run. Try something like this:
            // create the process to test
            Process acm = Runtime.getRuntime().exec("cmd /c java Testing");
            // send input
            PrintWriter processOut = new PrintWriter(acm.getOutputStream());
            processOut.print("input");
            processOut.flush();
            processOut.close();
            // get output
            StringBuilder givenOutputBuilder = new StringBuilder();
            BufferedReader processIn = new BufferedReader(
                    new InputStreamReader(acm.getInputStream()));
            String line = processIn.readLine();
            while (line != null) {
                givenOutputBuilder.append(line + "\n");
                line = processIn.readLine();
            }

  • How can i execute java program in JSP ?

    att
    thanks

    try to use:
    Runtime.getRuntime().exec("command line");
    where "command line" is your command to execute your program.

  • How to call java program through ODI

    Hi,
    I have written java program which i want to run though ODI.My questions are as follows:
    1. At which place i need to put my code and jar files i.e. do i need to put my code on the machine where ODI is installed?
    2. which technology to use i.e. jython or java bean shell.
    3. Commands format for jython or java bean shell.
    Is there any book or forum to which i could refer to get a deeper knowledge about these as i am new to ODI.
    Thanks
    Abhi

    881195 wrote:
    Hi,
    I have written java program which i want to run though ODI.My questions are as follows:
    1. At which place i need to put my code and jar files i.e. do i need to put my code on the machine where ODI is installed?You need to place the JAR file at ODI's driver folder.
    2. which technology to use i.e. jython or java bean shell.You can use Jython or Java bean shell . I prefer Jython .
    3. Commands format for jython or java bean shell.In your procedure , set the technology to Jython .
    Write normal java commands ... like
    import <your_class_name>
    <you operation etc>
    >
    Is there any book or forum to which i could refer to get a deeper knowledge about these as i am new to ODI.
    Thanks
    Sutirtha

  • How a java program is executed ?

    Hi,
    I would like to understand what a java program calls at first. Is it the main() ?
    Is it the same as C++ ?
    Is it different for an applet?
    thanks
    djb

    For an application, yes, public static void main(String[] args)
    (unlike C++ you cannot have main return an int, and it must have a String[] as a parameter)
    For an applet it calls public void init(), then usually public void start()
    Cheers,
    Radish21

  • Executing java class through servlet

    Hi,
    I am facing one problem and would be glad if I could get an input.
    I'm working on admin module and want to execute some java program which may take 10mins. for execution through either JSP or Servlet. DO any of you know how this could be done ?
    thanks
    Amit.

    Do you mean that you want to run a Java class from a servlet and wait till that class finishes off?

  • Execute java program on UNIX

    I have no experience on Unix and I now need to try to execute my java program on UNIX server to which I connect using telnet. I have copy my source file to the server and I could run the javac command to compile my source code.
    In the current directory, I just execute "javac mySource.java"
    And I got my .class file on the same directory. But when I tried to execute "java mySource", I got NoClassDefFoundError. I think it has something to do with classpath. But I just don't know how to do it in UNIX. Please someone assist me. Thanks.

    Or setenv CLASSPATH $CLASSPATH:/your/classpath/here if you are running csh.

  • Creating an executable java program

    hello every body
    i have finished my java program
    and i want to ask if there is some software that create a .exe of your project or make your projecte installable.
    for the moment i use javaexe but it's not really good
    do someone have an idea.

    That's the question most people ask.Actually this
    proccess is againts the goal of java for being a
    platform independent programing lang,That's an urban legend I haven't heard in a while -:)
    How can the generation of a native executable out of a Java source be against the goals of Java? Has the source code been contaminated in any way in the process? Is it now less portable than before? The native executable itself isn't portable of course but that's kind of the point of producing one, and it doesn't restrict the portability of the program itself.

Maybe you are looking for