Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

trying to write a java daemon

  • 06-02-2010 03:18PM
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 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, Registered Users 2 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, Registered Users 2 Posts: 134 ✭✭d4v1d


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

    much appreciated.


Advertisement