9 Replies Latest reply: Jun 8, 2009 12:31 AM by 843804 RSS

    Error occurred during initialization of VM

    843804
      I have installed J2SDK 1.4.2.0 in a sun solaris 5.8 machine. When I try to execute java, Im getting the following error..

      bash-2.03$ java
      Error occurred during initialization of VM
      java/lang/NoClassDefFoundError: java/lang/Object

      Please help
        • 1. Re: Error occurred during initialization of VM
          843804

          I've have had the same failure message today.


          My environment differs, I have Debian Sarge Linux, and I tried with JDK 1.5.0_01,downloaded as *.rpm file, and converted into *.deb using alien.
          (The error appears like some environment variable like JAVA_HOME is wrong but I did not succeed in figuring out how to set it right.)

          The solution was to download again: The simple self-extracting binary (instead of the rpm version).
          Now it works.


          I've found the Solution in:
          http://www.linuxquestions.org/questions/archive/26/2003/10/4/108638
          Greetings,
          Ratsberg
          • 2. Re: Error occurred during initialization of VM
            843804
            I had this error too under Websphere. The solution was to point to the correct rt.jar file.
            Since I did an upgrade of my j2sdk my java projects were trying to complie with another rt.jar version... also I had an major:minor version error but this fixs too.
            • 3. Re: Error occurred during initialization of VM
              843804
              Hii,
              I have installed J2SDK 1.5.0_05 in my IBM laptop. When I try to execute java, Im getting the following error..

              Error occurred during initialization of VM
              java/lang/NoClassDefFoundError: java/lang/Object

              Please help
              • 4. Re: Error occurred during initialization of VM
                843804
                help me what is the solution." Error occurred during initialization of VM"
                Thankyou.
                • 5. Re: Error occurred during initialization of VM
                  843804
                  This issue is usally caused by missing rt.jar. It's a good idea to manually unpack libraries.
                  Look for your java library directory (usually jre<version>/lib) .
                  If you can see rt.pack and can't see rt.ajr -
                  make the follwoing (I consider you save this to a script file then run it and your JAVA_HOME is correctly set and you're using some sort of UNIX):

                  ---------------------------------cut---------------------------------
                  #!/bin/sh
                  JH=${JAVA_HOME:-"/usr/java/jre1.5.0_04"}
                  UNPACK_EXE=$JH/bin/unpack200
                  if [ -f $UNPACK_EXE ]; then
                  chmod +x $UNPACK_EXE

                  PACKED_JARS="lib/rt.jar lib/jsse.jar lib/charsets.jar lib/ext/localedata.jar lib/plugin.jar lib/javaws.jar lib/deploy.jar"
                  for i in $PACKED_JARS; do
                  srcFile=${JH}/`dirname $i`/`basename $i .jar`.pack
                  dstFile=${JH}/$i
                  if [ ! -f  $srcFile ]; then
                  printf "Error: Unable to find %s. Please, check out your installation.\n" $srcFile
                  exit 1
                  fi
                  $UNPACK_EXE $srcFile $dstFile
                  if [ ! -f  $dstFile ]; then
                  printf "Error: unpack could not create %s. Please refer to the Troubleshooting\n" $dstFile
                  printf "Section of the Installation Instructions on the download page.\n"
                  exit 1
                  fi

                  rm -f $srcFile
                  done

                  else
                  printf "Error: unpack command could not be found. Please refer to the \n"
                  printf "TroubleShooting Section of the Installation Instructions on \n"
                  printf "the download page.\n"
                  printf "Please do not attempt to install this archive file.\n"
                  exit 2
                  fi
                  ---------------------------------cut---------------------------------
                  • 6. Re: Error occurred during initialization of VM
                    843804
                    A simpler way if you use alien to convert the rpm package and install, is to make sure you use the --scripts option to allow the conversion of the scripts that take care of the jar files. The scripts won't run unless they have been converted.

                    sudo alien --scripts -i javaInstallation.rpm                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                    • 7. Re: Error occurred during initialization of VM
                      843804
                      A cute (bizarre) little fact that can well cause such is that if something in your PATH Environment Variable is sufficiently weird..
                      (I dunno what that means exactly)

                      ..then it may never get to its tail end.


                      If you suspect this, put/move the part that gets the system to java at/near the beginning.

                      (just worked for me - again)


                      -- M.
                      • 8. Re: Error occurred during initialization of VM
                        843804
                        Here is an observation - running Windows XP recently I was asked if I wanted to update to Java 6-12, and I hit OK and went about my business while it installed. Afterwards tried a few java apps, and I got this exact scenario. Not that it makes sense, but after pottering around a long time with reinstalling Java, I finally clean uninstalled the JDK stuff which was on my start menu, and after that everything worked. I installed the latest JDK 5-13, problem solved.
                        • 9. Re: Error occurred during initialization of VM
                          843804
                          just working, I re-installed the system.