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)

Similar Messages

  • Problem with running java program

    Hey again!
    I missed out some information in last posting.. here is the full description
    I have just installed 1.5.0_06 and have set paths and what otherwise is necessary to run the java programs. I was testing the install and run a standard HelloWorld.java program
    I got the following error:
    Exception in thread main java.lang.NoClassDefFoundError: HelloWorld
    what is wrong...
    Here is the entire HelloWorld.java
    public class HelloWorld
    public HelloWorld()
    System.out.println("Hello World");
    public static void main(String[] args)
    HelloWorld hw = new HelloWorld();
    I have checked that the path is correct too..
    Hopefully someone can help me!
    Anders

    Your Path is set, probably the problem is classpath.
    Change the cmd/command prompt to the directory that contains your HelloWorld.class file, verifying that it exists. If it does, issue this command from that directory:
    java -cp . HelloWorld
    Important: include the period and surrounding spaces
    If that works, you can learn about setting and using the classpath here:
    http://java.sun.com/j2se/1.5.0/docs/tooldocs/index.html#general
    By the way, just add a reply to your original post with the additional information, rather than creating another post. That eliminates duplication of replies.

  • 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

  • Compile and run java programs in different directroy

    Hi,
    I often encounter many problems when I run java programs in the different directories. Like
    javac -d dir_name a.java
    java -cp dir_name a
    Something wired often happens, such as, there is not a.java file in some directory, but javac -d dir_name a.java can still work or "java -cp dir_name a" often doesn't work. Moreover, file_name.jar is also a tough problem and solving compiling problems is often time-consuming.
    So I hope to read something about how to compile and run java programs in different directory properly.
    Could you pleae give me a detailed description for that or recommend a book or website?
    Thanks a lot.

    Can you post a small amount of code that does not work, including the directory structure, and the error messages? Some one here can likely explain the problem.

  • I want to run java program on windows environment as background process

    Hi all
    I want to run java program on windows environment as background processSo command prompt return after executing java command and program on background In Linux we can do this easily �but I do not how to do this in windows
    for example look this programe
    import java.io.*;
    import java.util.*;
    public class TestClass {
         class ravi extends Thread{
              public void run(){
                   try {    
                        String target_file = "ravind.txt";
                        File targetfile = new File(target_file);
                        PrintWriter writer = new PrintWriter(new FileWriter(targetfile)) ;
                   for (int i =0 ; i < 100 ;i++ ){
                        Thread.sleep(10000);
                        writer.println(" ravindra shukla ");
              } catch (Exception e) {               
                             e.printStackTrace();
         public static void main(String[] args) {
              TestClass test1 = new TestClass();
              TestClass.ravi r1 = test1.new ravi();
              r1.start();          
    System.out.println(" return from main ");
    first i compile this
    javac TestClass.java
    then i run this by using this command
    java TestClass
    but becouse i put sleep on threads run function so it takes to much time to get return on command promt .... i want to run this programe as background process so command promt return as soon as i execute java command

    Thanks dude
    This solution �start java TestClass� works fine �. But it does not solve my problem
    It opens another black window and that black window persist till the life time of my program
    Is it possible application run on complete background without opening another black window �as in Linux

  • Cannot run java program after archive and install

    Hi,
    I am new to this forum and appreciate the help and advice given here.
    Yesterday, I did an archive and install on my system which install 10.4.3. Afterwards, I installed X11 and did the software updates which brought my system back to 10.4.8. It also installed Java 1.3.1, 1.4.2, and 1.5 (J2SE5).
    Prior to the archive and install, I had no problems executing a java program either in the command line in an X11 window or using Eclipse. However, when I try now I get the exception message "Exception in thread "main" java.lang.NoClassDefFoundError:". I checked my CLASSPATH and it's not the problem. I am able to compile, and execute the javadoc command. If I type java -version I get
    java version "1.5.0_06"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-112)
    Java HotSpot(TM) Client VM (build 1.5.0_06-64, mixed mode, sharing)
    Under Eclipse, I am able to see the Java versions under Preferences - Java - Installed JREs but if I go to the Run -> Run As menu, I see (none applicable).
    Thanks for any suggestions to fix this.
    James
    Dual 867MHz G4   Mac OS X (10.4.8)  

    I resolved the issue. I reinstalled XCode and had an issue with one of the files I was testing.

  • Can't Run Java Programs -- java.lang.NoClassDefFoundError Error

    I am running 10.4.11. For some reason I can no longer run Java programs. (I could in the past)
    For example. I create a simple Hello World program as follows and save it as Hello.java:
    class HelloWorld
    public static void main (String args[])
    System.out.println("Hello, world!");
    Then I compile it:
    Javac Hello.java
    Then I try to run it:
    java Hello
    But I get this error:
    Exception in thread "main" java.lang.NoClassDefFoundError: Hello
    I think it must be a CLASSPATH problem but normally you do not need to worry about ClassPATH. Apple sets it up for you out of the box.
    What is wrong?

    I totally forgot that the class name should be the same as the filename.
    After I renamed the file to HelloWorld.java and recompiled, I could run "java HelloWorld"
    Rob

  • Reg:Unix shellscripts running java programs

    hi,
    We are using unix shell scripts , by running that script it will execute some java programs.
    when we running shell scripts, which executes the programs it is generating some log files ie some error is occuring.
    i want to why these files are generating
    Thanks and Regards,
    Meer S.

    HI ,
    we are running the shell script which runs java programs,
    we are getting the result no problem ,
    but it is generating the unwanted ORBTRC files
    we are using websphere application server.
    we donot want these orbtrc files.
    HOW CAN WE DISABLE THE FILES
    pls guide this.
    Thanks and regards,

  • Vim and Eclim (Java): Run Java program in embedded terminal window

    Hello all,
    I'm trying to create a decent Vim setup for Java programming. I've installed Eclim, and it works alright. However, one annoyance I have is the way that Eclim runs Java programs. When run (via the :Java command in Vim), a Java program runs in a new shell instance pretty independent from Vim, and then when the program terminates (and Enter is pressed), the output is put into a new buffer at the bottom of the Vim window with the output.
    The problem with this is that I must press Enter to go back to Vim after the program terminates, and then the output buffer is automatically selected even though I most likely do not care to copy any of the output.
    So, this is what I would like to happen:
    - I run my Java program somehow (doesn't have to be with :Java)
    - A buffer containing the running program in a shell is put on the screen (if not already there)
    - The program terminates, and the focus did not change to the output buffer
    At the very least, I want the focus to not change to the output buffer after the program is done running.
    Any ways to at least somewhat accomplish what I'm trying to  get at?

    Trent wrote:
    Yeah? I had AP CS when they first introduced the GridWorld case study. I hope you get more out of the class than I did.
    I have never used Java except for that and my first CS class at university. I eventually realized that software (as a job) wasn't for me and took a route closer to EE. I still fight to avoid being called a programmer though
    I like the idea of programming for a job, not necessarily "software development", something computer science-y sound good to me.
    But anyway, to end on an on-topic note, I embedded gvim inside Eclipse as described here.

  • 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.

  • Running java program at windows startup

    I need to run java program at startup and then it will continue to run in its own thread.
    Any body having idea how to do that programmatically?
    Zeeshan

    This is one option but this is not feasible in my scenario as this application will be running over a network which involves hundreds of computer so is there any way to do it programatically?
    I mean if I can load java class file through an exe file then I can load my class file in the startup using C++.
    Any Suggestions.
    thanks for the help
    regards,
    Zeeshan

  • Can't run java program with GUI

    My computer can run java program properly.
    However, for those program with GUI (using swing),
    my computer is unable to display the GUI.
    What's wrong with it? Is there any PATH I need to set before running GUI program?
    Thanks
    icedgold

    Cut, copy, paste then compile and run this;-import java.awt.*;
    import javax.swing.*;
    public class MyJFrame extends JFrame {
      public MyJFrame() {
          super("My first JFrame");
          Container c  = getContentPane();
          JPanel panel = new JPanel();
          panel.setBackground(Color.white);//  (new Color(255, 255, 255));
          JLabel jl = new JLabel("Yes it works");
          panel.add(jl);     
          c.add(panel);
      public static void main(String[] args) {
        MyJFrame frame = new MyJFrame();
        frame.setSize(180,120);
        frame.setLocation(200, 300);
        frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
        frame.setVisible(true);
    }

  • How to Set up the  variables and others to compile and Run Java Programs

    Hello,
    I have just downloaded the jdk1.6.0_07 and jre1.6.0_07 and installed it in C:\Program files\Java in my Windows XP ,So please tell me how to sett up the enviroment variables etc to compile and run Java Programs from Command Prompt.
    thanks

    To set the PATH permanently, add the full path of the jdk1.6.0_<version>\bin directory to the PATH variable. Typically this full path looks something like C:\Program Files\Java\jdk1.6.0_<version>\bin. Set the PATH as follows on Microsoft Windows:
    1. Click Start > Control Panel > System on Windows XP or Start > Settings > Control Panel > System on Windows 2000.
    2. Click Advanced > Environment Variables.
    3. Add the location of bin folder of JDK installation for PATH in User Variables and System Variables. A typical value for PATH is:
    C:\Program Files\Java\jdk1.6.0_<version>\bin

  • Run java program in background

    I want to run a java program in background in windowsXP...can anyone help please......can anyone suggest an easy software for running java program as windows service...i tried one but without any success

    How many of the links here have you tried while you were waiting for an answer?
    http://www.google.com/search?q=running+java+program+as+windows+service
    (Note that the query is a direct copy/paste from your post.)

  • How to run java program from website?

    Hello
    I'd like to know how to run java program from my web page.
    I'd like to push some button in this web page so java program that would be on my server
    would pop-up. Can it be done automaticaly upon running this web site? (without any buttons - I just enter website and program pops up).
    Cheers

    I rather thought about RMI. But I could try servlets. So how it would look like?.
    I would make http request in browser (enter address) and program would show up in its window?. And I would not have to change anything in my program?. This program would run then on both boxes?. One remotely and one not?.
    But I would have to learn some basics, I've never worked with servlets. Could you suggest some good sites about it?. With ready examples so I could tweak them to my purpose.
    Message was edited by:
    macmacmac

Maybe you are looking for

  • *Help, please* Preserve Community Styles in Gateway?

    -Plumtree, I really do need some help on this one. I know that our requirements are probably past the scope of what community branding was meant to accomplish, but they are requirements nonetheless... I have 2 issues - 1) I need to preserve Community

  • Cant make / receive call & sms

    Im having problem with making calls & receiving calls. *im using iPhone 4 (GSM), iOS 5.0.1, Carrier is Maxis (Malaysia) When i make call, the receivers' phone will rings, but when they answer, my iPhone is still showing "Calling..." then when i press

  • Iphoto related question: How i can order a Poster at Mac shop for a Photographie of mine

    I´d like to get support, in order to be able for ordering from my Iphoto application a Poster (print) at Mac shop for a Photographie . thanks markos

  • Disk/file error

    On a G5 running Leopard, I have a file somewhere that causes all kinds of problems. This has been carried over from Tiger and probably before. Somewhere there is a clitch with routine disk maintenance. This issue causes problems with Migration Assist

  • Introscope WebView password - what is it?

    hello all, i am running WAS J2EE Engine 6.40 with SP10 in windows. after reading the postings to this forum on profiling tools, i tried and installed Introscope from Wily Technologies. it came on a CD shipped with my net weaver '04 package. following