Find the answer to your Linux question:
Results 1 to 8 of 8
Exception in thread "main" java.lang.NoClassDefFoundError Caused by: java.lang.ClassNotFoundException at java.net.URLClassLoader$1.run(URLClassLoader.java: 200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.j ava:18 at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06) at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51) at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319) This ...
  1. #1
    Just Joined!
    Join Date
    May 2008
    Posts
    4

    Java error

    Exception in thread "main" java.lang.NoClassDefFoundError
    Caused by: java.lang.ClassNotFoundException
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:18
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
    at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)
    This is the error while i try to do anything with java... Whats the problem?

  2. #2
    Linux Guru techieMoe's Avatar
    Join Date
    Aug 2004
    Location
    Texas
    Posts
    9,496
    What, specifically, are you trying to do? You might have just the Java Runtime Environment (JRE) installed and it's looking for the full Java Development Kit (JDK).
    Registered Linux user #270181
    TechieMoe's Tech Rants

  3. #3
    Linux Engineer Thrillhouse's Avatar
    Join Date
    Jun 2006
    Location
    Arlington, VA, USA
    Posts
    1,377
    Why would he need the JDK, Moe? This is a runtime exception.

    More information is definitely needed, though. Are you trying to run something you wrote and compiled yourself or are you trying to run something you downloaded from somewhere?

  4. #4
    Just Joined!
    Join Date
    May 2008
    Posts
    4
    I installed JDK, but maybe classpath thing is wrong?


    Code:
    root@server [~]# java -version
    java version "1.6.0_06"
    Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
    Java HotSpot(TM) Server VM (build 10.0-b22, mixed mode)
    root@server [~]# which java
    /usr/bin/java
    root@server [~]# which javac
    /usr/bin/javac
    root@server [~]# echo $JAVA_HOME
    /usr/local/jdk
    root@server [~]# echo $PATH
    /usr/local/jdk/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/courier-imap/sbin:/usr/lib/courier-imap/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin
    root@server [~]# echo $CLASSPATH
    .:/usr/local/jdk/lib/classes.zip
    Last edited by techieMoe; 05-27-2008 at 07:36 PM. Reason: Changed "quote" tags to "code" tags.

  5. #5
    Linux Guru techieMoe's Avatar
    Join Date
    Aug 2004
    Location
    Texas
    Posts
    9,496
    Ok. What are you launching that causes that error?
    Registered Linux user #270181
    TechieMoe's Tech Rants

  6. #6
    Just Joined!
    Join Date
    May 2008
    Posts
    4
    a game server...

    killall -9 java
    javac *.java
    java -Xmx2500m server
    this is in run.sh ...


    but java doesnt react to anything.. always same error...

    i can type..

    java blabla ..same error
    java run.sh ..same error
    java heyyooafafr .. same error..

  7. #7
    Linux Engineer Thrillhouse's Avatar
    Join Date
    Jun 2006
    Location
    Arlington, VA, USA
    Posts
    1,377
    It's complaining because you're trying to run a Java class named 'server'. If you don't have one, it's going to throw a NoClassDefFound exception, which it did. Your Java call should be to the class that contains your "main()" and it is case sensitive.

    Also, 2500M is a rather large max heap size. Do you really need that much?

  8. #8
    Just Joined!
    Join Date
    May 2008
    Posts
    4
    Now it works, i ran wrong command...

    But if i do..

    killall -9 java
    javac *.java
    java -Xmx2500m server
    - thats in run.sh

    Also... if i use command

    sh ./run.sh

    server will start... yay, server is online.. all is fine..
    but if i close the SSH client, server will also disconnect... whys that?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...