Eclipse: failed to create the java virtual machine [fix]

04 Jul 2011

After a software update for my MacBook, my Eclipse failed to load properly. No matter what I tried, it kept throwing me the following error: "Failed to create the Java Virtual Machine." Half an hour of Googling provided me with many solutions, but unfortunately none of them fixed the issue. So I decided to do a little research and came up with a solution on my own. Here's a guide that will help you fix it.
  1. After the Mac Software Update (of June 28th 2011) there should be a new version of the Java Virtual Machine installed. In my case, it failed to install and the update set a reference to a folder that simply didn't exist. What the folder should look like: "System/Library/Frameworks/JavaVM.Framework/Versions/1.6.0". The 1.6.0 folder was missing. If this folder already exists, skip to the very last part of this guide.
  2. The 1.6.0 folder is missing, so we should get it! Download & install the latest version (which is 1.6.0) of Java for Mac from the Apple website: http://support.apple.com/kb/DL1360 .
  3. After install, make sure the folder exists! (see the path in step 1).
  4. Make sure the reference to the Virtual Machine is set correctly. CMD+Click the Eclipse executable in your Finder and choose: "Show Package Contents". Now open the .ini file Located in "Contents/MacOS/Eclipse.ini". The file should include the following line: "-vm/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java". If this line doesn't exist, or is still referring to an older version of Java, please edit/add the line. Save the .ini file and start Eclipse! Voila, it's a miracle.
Please leave a comment if this was helpful to you.