Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

trying to write a java daemon

Options
  • 06-02-2010 3:18pm
    #1
    Registered Users Posts: 134 ✭✭


    i am currently trying to write a java daemon and it is still very much in a test stage.

    the basic steps is that
    1. the service starts.
    2. reads some configuration
    3. starts up a new thread
    4. opens a server socket listening on a port specified in the configuration.

    whenever i try to run the program i keep hitting...
    [Exception in thread "main" java.lang.NoClassDefFoundError: lld
    Caused by: java.lang.ClassNotFoundException: lld
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    Could not find the main class: lld. Program will exit.]

    i've attached the test application i am trying to use and the configuration file that i have created.

    to start it I am using
    [java -cp . lld -DLLD.properties]

    anyone have any ideas on where i'm going wrong.


Comments

  • Registered Users Posts: 134 ✭✭d4v1d


    made some progress, by playing around with this using testng i managed to get the service started from within eclipse. i just now need to start it from the command line. i've modified the class name to
    [java -cp . com.<package>.<classname> -DLLD.properties]

    ...where classname contains the main() function.

    still can't get it to start though


  • Registered Users Posts: 363 ✭✭Rockn


    After extracting your zip file to RunTest and starting with the command line in that folder:

    compile:
    javac -cp java_daemon/src/main/java/ java_daemon/src/main/java/com/lld/main/StartDaemon.java

    run:
    java -cp java_daemon/src/main/java/ -DpropertiesFile="LLD.properties" com/lld/main/StartDaemon

    any help?


  • Registered Users Posts: 134 ✭✭d4v1d


    yes, thank you. i knew it was something silly i was missing.

    much appreciated.


Advertisement