• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java on linux: VM initialization error: can't find java.lang.Object class definition  RSS feed

 
Steve Body
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've used java for a while on numerous windows machines and had no problem installing. Now I'm trying linux and I have a problem.

I've installed jdk1.5.0_07 on Fedora 5.
I've put the bin in the path.
When I type 'java' at the terminal prompt, I get the following:

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

I have googled this and there are numerous postings of this problem. There are at least as many 'solutions' as postings. Most of them are pretty useless ('reinstall' (why would that fix it?); 'there could be hundreds of reasons' (but which is the right one?)). Others are inapplicable or don't work.

This has the smell of something fairly simple. Any *useful* insights most gratefully received!

Thanks,

Steve
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Fedora, during the installation process you could have installed the GNU JDK.

This is problem, even if you install Sun JDK, because the GNU JDK create shortcuts for their programs in the /usr/bin directory.

Hence, do this:

  • Install Sun JDK in the /opt directory or wherever you prefer.
  • Add the the bin directory to $PATH variable. If you do no mind this path to be public to all the user of your computer, do it in the /etc/profile file. If not, do it in the ~/.bashrc file.
  • Check if the java and javaw commands that you use from the command line are those comming from the /opt/jdk directory. Check by means of using the which command, for instance, write which java in the command line, and the output should say /opt/jdk/bin/java. If it says something like /usr/bin/java, well the GNU JDK may installed in your computer.
  • If GNU JKD is installed, remove the /usr/java and /usr/javac and all other java links in the /usr/bin directory.
  • Or If you want you can replace those GNU links with the correct links of your SUN JDK. Use the ln command to create links to the correct programs after you have deleted those of the GNU.
  • Consider declaring the $JAVA_HOME variable also, because some other programs, like ant, use it.



  • Some Linux installations offer you the chance to install a few Java tools, like Eclipse or Ant. I always prefer to do that by myself, because I almost never get to decipher what the heck those distributions locate the files that I need.

    Good luck, comrade!
    [ June 09, 2006: Message edited by: Edwin Dalorzo ]
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!