8 Replies Latest reply: May 5, 2007 4:39 PM by 807599 RSS

    java.lang.NoClassDefFoundError  Again

    807599
      Hi All, well, i instaled Java runtime 6, then javaSDK 1.4.2 and then i setted:

      CLASSPATH=H:\j2sdk1.4.2_13\bin
      Path=H:\j2sdk1.4.2_13\bin

      But when i try to run a simple .java, in this case, HelloWorld it returns me the error "java.lang.NoClassDefFoundError"

      I am Using Windows XP 64Bits.

      Im needing this very urgently any reply will be greatly tanked =)

      Regards, JotaC
        • 1. Re: java.lang.NoClassDefFoundError  Again
          791266
          You should start your application by typing.
          java -cp . NameOfMainClass
          Kaj
          • 2. Re: java.lang.NoClassDefFoundError  Again
            807599
            yes i knwo but thats not the problem, it seems the class libraries are mussing or something..

            ---------------
            H:\Documents and Settings\Administrator> java -cp . HelloWorld

            Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
            ----------------
            • 3. Re: java.lang.NoClassDefFoundError  Again
              791266
              yes i knwo but thats not the problem, it seems the
              class libraries are mussing or something..

              ---------------
              H:\Documents and Settings\Administrator> java -cp
              . HelloWorld

              Exception in thread "main"
              java.lang.NoClassDefFoundError: HelloWorld
              ----------------
              No, that means that the class HelloWorld can't be found in the current directory.

              Kaj
              • 4. Re: java.lang.NoClassDefFoundError  Again
                807599
                *Missing   not mussing, lol                                                                                                                                                                                                                                       
                • 5. Re: java.lang.NoClassDefFoundError  Again
                  807599
                  Yes.. but the problem is that ANY program to work in java simply doesnt work, i tryed everything, i need to run the following:

                  Register.exe
                  ---
                  @echo off
                  SET OLDCLASSPATH=%CLASSPATH%
                  call setenv.bat

                  @java -Djava.util.logging.config.file=console.cfg net.sf.l2j.gsregistering.GameServerRegister

                  SET CLASSPATH=%OLDCLASSPATH%
                  @pause


                  _____________ setenv,bat


                  REM Hibernate and associated jars
                  SET CLASSPATH=%CLASSPATH%;antlr-2.7.6.jar
                  SET CLASSPATH=%CLASSPATH%;asm-1.5.3.jar
                  SET CLASSPATH=%CLASSPATH%;cglib-2.1_3.jar
                  SET CLASSPATH=%CLASSPATH%;hibernate-3.2.2.ga.jar
                  SET CLASSPATH=%CLASSPATH%;jta-1.0.1B.jar
                  SET CLASSPATH=%CLASSPATH%;commons-collections-2.1.1.jar




                  REM for second level cache (hibernate)
                  SET CLASSPATH=%CLASSPATH%;ehcache-1.2.3.jar

                  SET CLASSPATH=%CLASSPATH%;mmocore-1.0.2.jar

                  REM for bean use
                  SET CLASSPATH=%CLASSPATH%;commons-beanutils-1.7.0.jar

                  REM For connection pool
                  SET CLASSPATH=%CLASSPATH%;c3p0-0.9.0.4.jar

                  REM for logging usage
                  SET CLASSPATH=%CLASSPATH%;commons-logging-1.1.jar
                  SET CLASSPATH=%CLASSPATH%;log4j-1.2.12.jar

                  REM for common input output
                  SET CLASSPATH=%CLASSPATH%;commons-io-1.2.jar

                  REM for dom
                  SET CLASSPATH=%CLASSPATH%;dom4j-1.6.1.jar

                  REM for performance usage
                  SET CLASSPATH=%CLASSPATH%;javolution-1.5.4.2.6.jar

                  REM main jar
                  SET CLASSPATH=%CLASSPATH%;l2j-commons-1.0.4.jar
                  SET CLASSPATH=%CLASSPATH%;l2j-loginserver-1.0.0.jar

                  REM spring
                  SET CLASSPATH=%CLASSPATH%;spring-2.0.2.jar

                  REM For SQL use
                  SET CLASSPATH=%CLASSPATH%;mysql-connector-java-3.1.11.jar

                  REM for configuration
                  SET CLASSPATH=%CLASSPATH%;./config/
                  SET CLASSPATH=%CLASSPATH%;.


                  //////

                  And i get the same result, it works in My other computer, windows xp media center, same version of java, and it doesnt give any error in HelloWorld, so problem is somethig in my windows...
                  • 6. Re: java.lang.NoClassDefFoundError  Again
                    791266
                    And i get the same result, it works in My other
                    computer, windows xp media center, same version of
                    java, and it doesnt give any error in HelloWorld,
                    You do in that case have HelloWorld in the current directory when you are executing on the other machine.
                    so problem is somethig in my windows...
                    Probably not. It's more likely that it's the error is in the installation of the game or whatever it is that you are trying to start.

                    Kaj
                    • 7. Re: java.lang.NoClassDefFoundError  Again
                      807599
                      And i get the same result, it works in My other
                      computer, windows xp media center, same version of
                      java, and it doesnt give any error in
                      HelloWorld,
                      You do in that case have HelloWorld in the current
                      directory when you are executing on the other
                      machine.
                      so problem is somethig in my windows...
                      Probably not. It's more likely that it's the error is
                      in the installation of the game or whatever it is
                      that you are trying to start.

                      Kaj
                      As i said before, everything works fine in a Windows XP media center edition, same software, same java version, same folders, all working, it doesnt work in my windows XP 64 bits only...
                      • 8. Re: java.lang.NoClassDefFoundError  Again
                        791266
                        As i said before, everything works fine in a Windows
                        XP media center edition, same software, same java
                        version, same folders, all working, it doesnt work
                        in my windows XP 64 bits only...
                        And I told you what NoClassDefFoundError means. Trust me. I've been programming in Java for more than 10 years. The error message that you posted means that the class HelloWorld couldn't be found. It was not an error message that was an indication of a bad java installation.

                        The problem can be that some windows 64bit versions are installing software in directories with spaces in the folder name, and the script that you posted might not be able to handle that.

                        Kaj