---Reprinted from http://www.newthinktank.com/2011/12/install-java-1-7-eclipse/
I’m beginning a new Java tutorial using Eclipse as my IDE. Every time I have used Eclipse in the past there have been installation problems so, I’ll try to fix that issue here.
I use Eclipse because in my opinion it is the best free IDE available.
Also note that I’ll provide Java 1.7 installation steps for PCs, but Java 1.6 & 1.7 steps for MACs. The reason why I’m doing that is because Java 1.7 isn’t quite ready yet for Eclipse on MACs.
Don’t worry, there isn’t that much of a difference between Java 1.6 and 1.7. At least for a beginner tutorial.
Checking Your Version of Java
Java 1.6 has been around since December 2006, so chances are you already have it installed on your computer. To find out type the following in either your Terminal (MACs), or Command Line (PCs) java -version
When you do you’ll probably see the following:
java version "1.6.0_29" Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527) Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)
Install Java 1.7 MACs
If you don’t have Java 1.6 installed for Mac go here to get it. You can get a preview release of Java 1.7 for Mac here.
Here are the instructions on how to install it from Oracle:
- Manually create a JavaVirtualMachines directory under /Library/Java if it does not exist already:
$> sudo mkdir /Library/Java/JavaVirtualMachines
- Download the Oracle JDK7 Mac OS X Port DMG file
- Open the DMG file by double clicking on it
- Drag the JDK 1.7.0 Developer Preview icon to the JavaVirtualMachine icon
- Execute Eclipse and then click on Elipse and Preferences in the top menu
- Expand the list item named Java and click Installed JREs
- Click the Add… button
- Java 1.6 should be set as the default
- If not select Standard VM in the JRE Popup Window
- Type /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home into JRE home
- Type Java1.6 as the name
- Click Finish
- Execute Eclipse and then click on Windows and Preferences in the top menu
- Expand the list item named Java and click the Compiler option (Don’t Expand it)
- Check if Compiler Compliance Level is set to 1.7
- If it isn’t change it to 1.7 in the dropdown
- Click on Installed JREs and if you see jre6 as checked you’re done
- If jre6 isn’t checked click the Add… button
- Select Standard VM in the JRE Popup Window
- Under Directory select the home directory for JRE 1.7 (See Above)
- Click Finish