Re: Java server won't run after reboot

From: Reuben D. Budiardja (techlist_at_voyager.phys.utk.edu)
Date: 05/29/04

  • Next message: Reuben D. Budiardja: "Re: Java server won't run after reboot"
    To: General Red Hat Linux discussion list <redhat-list@redhat.com>, Michael Sullivan <msulli1355@tulsacoxmail.com>
    Date: Sat, 29 May 2004 12:59:44 -0400
    
    

    On Saturday 29 May 2004 12:16 pm, Michael Sullivan wrote:
    > First off, I'm not sure if this is a java problem or a Linux problem.
    > If you think it's a Java problem, tell me and I'll send this question to
    > a Java list. I wrote a java server that I want to start every time my
    > server PC restarts. I created a /usr/local/classes directory and copied
    > Server.class and the support classes it uses there. Id cd'd to
    > /usr/local/classes and issued a java Server from there and it works
    > fine, but if I issue a java /usr/local/classes/Server from anywhere
    > outside the /usr/local/classes directory it tells me
    >
    > Exception in thread "main" java.lang.NoClassDefFoundError:
    > /usr/local/classes/Server
    >
    >
    > I don't think this is a java problem because it doesn't give me this error
    > if I ask to run the Server from within /usr/local/classes. I've tried
    > editing rc.local to say "cd /usr/local/classes" and then "java Server" and
    > I've tried calling an executable batch file from rc.local that cd's to the
    > /usr/local/classes directory and then "java Server", which works from the
    > command line, but doesn't work after reboot. Can anyone help me?

    Try the following:
    set the environment variable CLASSPATH to /usr/local/classes so that Java
    knows where to find your classes. Asumming you're using bash:
    $> export CLASSPATH=$CLASSPATH:/usr/local/classes

    then try to run your application from outside the directory. If it starts
    fine, then put that also in rc.local:

    export CLASSPATH=$CLASSPATH:/usr/local/classes
    java /usr/local/classes/Server

    Basically, java need to know where to find the classes. If you're in the
    directory itself, then it defaults to find the classes in the current
    directory. If you're running the program from outside directory, you need to
    tell it where to find the java classes, hence the CLASSPATH environment
    variable.

    HTH

    RDB

    -- 
    Reuben D. Budiardja
    Department of Physics and Astronomy
    The University of Tennessee, Knoxville, TN
    ---------------------------------------------------------
    "To be a nemesis, you have to actively try to destroy 
    something, don't you? Really, I'm not out to destroy 
    Microsoft. That will just be a completely unintentional 
    side effect."
                     - Linus Torvalds -
    -- 
    redhat-list mailing list
    unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
    https://www.redhat.com/mailman/listinfo/redhat-list
    

  • Next message: Reuben D. Budiardja: "Re: Java server won't run after reboot"

    Relevant Pages

    • Java Newb
      ... I just started a java class and I have this assignment and I'm ... Java Problem ...
      (comp.lang.java)
    • Re: Is it possible to do a clean installation of FC5?
      ... I have considered just reinstalling FC4, but thought why not the newest FC5. ... Apart from the java problem, my Linux system works just fine. ...
      (linux.redhat.install)
    • Re: Java server wont run after reboot
      ... I'm not sure if this is a java problem or a Linux problem. ... set the environment variable CLASSPATH to /usr/local/classes so that Java ... you have to actively try to destroy ...
      (RedHat)
    • CWShredder found a cwstrojan ........
      ... a 'DOUBLE-SECRET' patch or something!!--But u SAY it ... doesn't stop the JAVA hole anyway!--I'm jus SICK an' ... >>eliminates this JAVA problem instead of putting ... >>Didnt CWS remove the trojan? ...
      (microsoft.public.windowsxp.security_admin)
    • Re: Process.destroy() on Win32
      ... > Another thread calls AntThread's interrupt() method, ... > process (an ant build process, which itself uses java) does not end. ... Does anyone know why the destroy() method is not destroying, ... The standard solution is to initiate two threads that consume the ...
      (comp.lang.java.programmer)