How do I use JDK 7 on Mac OSX?

前端 未结 15 2178
滥情空心
滥情空心 2020-11-29 17:13

I would like to use the WatchService API as mentioned in this link: http://download.oracle.com/javase/tutorial/essential/io/notification.html

After reading around, I

相关标签:
15条回答
  • 2020-11-29 17:35

    Oracle has released JDK 7 for OS X.

    0 讨论(0)
  • 2020-11-29 17:36

    It's possible that you still need to add the JDK into Eclipse (STS). Just because the JDK is on the system doesn't mean Eclipse knows where to find it.

    Go to Preferences > Java > Installed JREs

    If there is not an entry for the 1.7 JDK, add it. You'll have to point Eclipse to where you installed your 1.7 JDK.

    If Eclipse can't find a JRE that is 1.7 compatible, I'm guessing that it just uses your default JRE, and that's probably still pointing at Java 1.6, which would be causing your red squiggly lines.

    0 讨论(0)
  • 2020-11-29 17:45

    This is how I got 1.7 to work with Eclipse. I hope it helps.

    1. I Downloaded the latest OpenJDK 1.7 universal (32/64 bits) JDK from Mac OS/X branch from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
    2. copied the jdk to /Library/Java/JavaVirtualMachines/ next to the default 1.6.0 one
    3. In Eclipse > Preferences > Java > Installed JREs you add a new one, of type MacOS X VM, and set the home as /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home and name Java SE 7 (OpenJDK)
    4. Click Finish
    5. Set the added JRE as default

    that should be it :)

    0 讨论(0)
  • 2020-11-29 17:45

    I updated to Yosemite and Android Studio wouldn't clean my projects or Run them on virtual or real device because of the following error:

    Failed to complete Gradle execution.Cause:Supplied javaHome is not a valid folder. You supplied: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    

    After some research and trouble shooting, I found that the JDK file that was being pointed to at "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home" wasn't there; all of "JavaVirtualMachines/1.6.0.jdk/Contents/Home" was missing from "/System/Library/Java". So, I copied "JavaVirtualMachines/1.6.0.jdk/Contents/Home" over from "/Library/Java/" to "/System/Library/Java/" and cha ching! I was back in business.

    0 讨论(0)
  • 2020-11-29 17:46

    Now, Use command

    Update 2020: 04

    To install Java7 with homebrew run:

    brew tap homebrew/cask-versions
    brew cask install java7
    

    Hope this help.

    0 讨论(0)
  • 2020-11-29 17:48

    How about Netbeans, here is an article how to set it up with NB7:

    http://netbeanside61.blogspot.com/2011/06/downloading-openjdk7-binary-for-mac-os.html

    Maybe similar steps for Eclipse.

    0 讨论(0)
提交回复
热议问题