Install Jdk for Eclipse

来源:互联网 发布:吉他谱软件哪个好 编辑:程序博客网 时间:2024/05/22 06:25

---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:

  1. Manually create a JavaVirtualMachines directory under /Library/Java if it does not exist already:
    $> sudo mkdir /Library/Java/JavaVirtualMachines
  2. Download the Oracle JDK7 Mac OS X Port DMG file
  3. Open the DMG file by double clicking on it
  4. Drag the JDK 1.7.0 Developer Preview icon to the JavaVirtualMachine icon
Install Eclipse Java 1.6 & 1.7 for Macs
Now that you have Java setup on your Mac, it is time to set up Eclipse. Go here to download the Eclipse IDE for Java Developers.
After you install Eclipse you have to set it up to work with Java.
  • 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
Do the same for Java 1.7, except leave 1.6 as the default and also instead enter Java1.7 for the name and the following for the JRE home /Library/Java/JavaVirtualMachines/JDK 1.7.0 Developer Preview.jdk/Contents/Home
You’re done and ready to use Java 1.6 & 1.7 in Eclipse
Install Java 1.7 PCs
For PCs go here to download Java 1.7 unless you already have it installed. Make sure you download the JDK and not the JDE. Find the Java executable you just downloaded and double click it. Follow the prompts to install it.
The Java files will be located at C:\Program Files\Java\jdk1.7.0 after installation.
Install Eclipse Java 1.7 for PCs
To get Eclipse to work on PCs is nearly identical to the MAC installation. Go here to download the Eclipse IDE for Java Developers.
After you install Eclipse you have to set it up to work with Java.
  • 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
Eclipse Code Completion for Java 1.7
To set up code completion for Java 1.7 in Eclipse just open your preferences folder, click on Compiler, and set Compiler Compliance Level to 1.7. This currently isn’t working for MACs, but should work soon. If you have a PC this will work.
- See more at: http://www.newthinktank.com/2011/12/install-java-1-7-eclipse/#sthash.FxDix91V.dpuf - See more at: http://www.newthinktank.com/2011/12/install-java-1-7-eclipse/#sthash.FxDix91V.dpuf
0 0
原创粉丝点击