Home Help Center

Running error in JAVA hello world demo

abhimohpraabhimohpra Member Prasad DixitOrganization: PersonalProject: A robotic platform to communicate remotely
Hello,
I am new to ice and java.
I get below errors even after setting my classpaths in helloworld java application.

MY classpaths are set like this in environment variables.
CLASSPATH="/usr/share/java/Ice.jar:."

Exception in thread "main" java.lang.NoClassDefFoundError: class
Caused by: java.lang.ClassNotFoundException: class
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: class. Program will exit.

My Server.class and Client.class are already created in classes directory. I am using UBUNTU system for execution.
I tried going into classes directory and executing java Server/Client command but output remains the same.
Any clues or am i missing anymore path settings?
- Prasad

Comments

  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hello Prasad,

    This is a pure Java issue - nothing to do with Ice, and probably nothing to do with your CLASSPATH. I can reproduce this very easily:
    $ java class
    Exception in thread "main" java.lang.NoClassDefFoundError: class
    Caused by: java.lang.ClassNotFoundException: class
            at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    Could not find the main class: class.  Program will exit.
    

    Cheers,
    Bernard
Sign In or Register to comment.