Install jdk1.7 (GO) under Mac

Source: Internet
Author: User
Tags java se

Transferred from: http://vela.diandian.com/post/2012-01-06/15379924

Recently, want to play jdk1.7, but the JVM under the Mac platform has been Apple's own change, all some trouble. This article is a detailed step to teach you how to install and use jdk1.7 under Mac. Of course, as you might imagine, I wouldn't write anything with a technical content, so it's just a simple guide.

  1. First of all, in order to reduce the problem, first to let the platform installed a java,snow leopard good (by default), Lion words by default is not installed any JVM, the installation method is very simple, enter Java under the terminal or launch any application that needs to use the Java Virtual machine, will automatically trigger the software update to install the JVM.

  2. Download the dedicated Mac version of the jdk1.7, the address is as follows:http://jdk7.java.net/macportpreview/, with the latest version (but still beta), version update frequency every two weeks will probably release a build , I installed the version is b223 (update, the latest version is b227, it is not openjdk).

  3. Next, double-click on the DMG to open, and then simply a drag and drop (this will not nonsense, will not drag the wall).

  4. Change the JVM preference order, search in Spotlight [Java Preferences] (Chinese version should be Java Preferences?). ), you should be able to see a few virtual machines already there, drag Java SE 7 to the top, you can (for example, I dragged the 64-bit version).

  5. Confirm the version that Java is using: Open a terminal, enter Java-version, and confirm that the JVM version number is jdk1.7.0.

  6. The following action is how to change the default JRE of Eclipse, first open eclipse (if you change the order of the JVM, let 1.7 on the top, and not in the eclipse configuration to write dead JVM boot location, it should have been started with jdk1.7).

  7. Open Preferences->java->installed JREs, see the right side of the JRE list, if you already use the default jdk1.6, click Add, select MacOS X VM, in the path to the location of the jdk7 to point to the installation.

  8. If you can't find the place where the damn jdk1.7 is installed, consider sticking to this address (this is the location of my system, I guess everyone should be about the same). /library/java/javavirtualmachines/jdk 1.7.0 Developer preview.jdk/contents/home

  9. Correctly, the following identifies a bunch of jar-pack locations, and then gives this piece of the JRE a handsome name.

  10. If you want to enable jdk1.7 syntax, you must have the Eclipse version above 3.8/4.2 (at the moment I write this blog, 4.2 has reached Milestone4), and then can be in workspace/ By adjusting the compilation level to 1.7 in the project properties, you can enjoy the language features of jdk1.7 (but only if the JDK and the JRE used must be above jdk1.7).

I hope this wordy article will be helpful to everyone.

Update information

  1. The eclipse version that supports the JAVA7 syntax starts from 3.7, as shown in the following address: Http://wiki.eclipse.org/JDT/Eclipse_Java_7_Support_%28BETA%29

  2. Under Mac, Eclipse will start using the system's jdk1.6 by default, as if the VM parameters that force modification of Eclipse.ini are not valid and must be modified eclipse.app/content/info.plist Open look inside there are notes written. However, I am still invalid here after eclipse4.2m4 modification.

  3. Sometimes some applications also use the old jdk1.6, such as maven will sometimes stick to the old version, and then have to find a place to export the next java_home variable. Change to jdk1.7 's home directory.

  4. jdk1.7 Macport from B11 began to merge the branch code, began to be installed directly using the installation program, the corresponding installation to the path also changed, is this:/library/java/javavirtualmachines/1.7.0.jdk/ Contents/home . Update on 2012-2-12

  5. Jdk1.7u6 B09, the bundle name is changed so that you can keep the old version while installing the new version. Of course, the path also changes and becomes this way:/library/java/javavirtualmachines/jdk1.7.0_ jdk, where 06 is the update version number. Simple you can make a soft connection, cd/library/java/javavirtualmachines;ln-s jdk1.7.0_. JDK 1.7.0.jdk, This will not be affected by the version upgrade (so that the JRE path set in Eclipse is used as a path in a soft connection). Update on 2012-5-11

  6. I forgot to start with a version, and Eclipse can already automatically use JDK7 after loading, so the second update above will void the bird:) Update on 2012-9-24

Install jdk1.7 (GO) under Mac

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.