Re: Java server won't run after reboot

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

  • Next message: Farkas Levente: "bug in raid5 in rhel 3"
    To: Michael Sullivan <msulli1355@tulsacoxmail.com>, redhat-list@redhat.com
    Date: Mon, 31 May 2004 08:35:49 -0400
    
    

    On Saturday 29 May 2004 05:44 pm, you wrote:
    > That didn't work. I still get the NoClassDefFoundError. Any other
    > ideas?

    You're right !! it doesn't work. I just try this myself, and whenever I try to
    execute from outside the directory where the java files is located, I got the
    same error. I thought I've seen this and what I suggested was the solution,
    obviously not ! (Now it should be obvious that I am not a java developer
    myself, I just play with it sometime)

    After some searching myself, I only have this solution:

    If for example, my java program is in ~/project/testjava/helloworld.java, I
    can put in helloworld.java:

    package project.testjava;
    <rest of the src code>

    then I need to go to ~, and compile it from there:
    javac project/testjava/helloworld.java

    and running it from there would work tpp:
    java project/testjava/helloworld

    The problems with the solution: First, I can't find a way so that I can use
    absolute path during compile and running (which is probably what you want in
    your case, since you're going to put the command in rc.local). So what I want
    is something so that I can say:

    javac /home/<username>/project/testjava/helloworld.java
    java /home/<username>/project/testjava/helloworld

    when I tried, the solution does not work. I can't also figure out what to put
    in after the "package" keyword in the source code to make the absolute path
    work.

    Secondly, the source code is dependent on what directory you want to compile
    and run the java program from. Unless I am missing something, that is just
    plain stupid !! Source code of a program should never be dependent on where
    the program is running from.

    So that's it. I am kinda stuck right now too. I don't know if that would help
    you, but if you find the real solution, please let me know, cause right now
    it bugs the hell out of me too ! (BTW, I have a task of writing some java
    program in the near future, so this would be good to know).

    I know this is going OT, but if anyone else on the list know a solution,
    please help.

    RDB

    > On Sat, 2004-05-29 at 11:59, Reuben D. Budiardja wrote:
    > > On Saturday 29 May 2004 12:16 pm, Michael Sullivan wrote:
    <snip>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
    <snip>
    > > 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
    > >

    -- 
    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: Farkas Levente: "bug in raid5 in rhel 3"

    Relevant Pages

    • Re: creaping coupling......
      ... In C++ it would be trivial to break that source code dependency, ... When you compile a .java module, ... In Java and C# it's asserted at compile time. ...
      (comp.object)
    • Re: Java server wont run after reboot
      ... > package definitions in your source code. ... Execute from that directory, no classpath definition needed. ... > java HelloWorld ... > If you compile to a different location, ...
      (RedHat)
    • Re: Something has to be tested and maintained was Re: GoTo in Java
      ... I am on record as saying that maintenance of source code is self defeating. ... every module or program when new functionality is added. ... is that a brick is a brick; it has the attributes and behaviours of a brick. ... to translate it to Java, and get something not too bad. ...
      (comp.lang.cobol)
    • Re: GoTo in Java
      ... >> to translate it to Java, and get something not too bad. ... > your 'cleaned up' Java now works the same as the Fortran code. ... NOT maintain source code. ... Encapsulate functionality and reuse it. ...
      (comp.lang.cobol)
    • Something has to be tested and maintained was Re: GoTo in Java
      ... to translate it to Java, and get something not too bad. ... Source code translations have been tried for several decades and they ... Because of its COBOL and procedural programming roots, ... Encapsulate functionality and reuse it. ...
      (comp.lang.cobol)