如何在Mac OSX上使用JDK 7? [英] How do I use JDK 7 on Mac OSX?

查看:281
本文介绍了如何在Mac OSX上使用JDK 7?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用此链接中提到的WatchService API:
http://download.oracle.com/javase/tutorial/essential/io/notification.html

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

阅读后,我发现WatchService是计划用于JDK 7的NIO类的一部分。因此,它是测试版。没关系。

After reading around, I found out that WatchService is part of the NIO class which is scheduled for JDK 7. So, it is in beta form. It's fine.

http:// jdk7。 java.net/download.html 包含我下载和提取的JDK。我有一堆文件夹。我不知道如何处理它们。

http://jdk7.java.net/download.html has the JDK which I downloaded and extracted. I got a bunch of folders. I don't know what to do with them.

然后,我读了一些更多,发现有一群好人创建了JDK 7作为二进制文件,所以有人喜欢我可以轻松安装。它被称为Open JDK:
http://code.google.com / p / openjdk-osx-build /

Then, I read around some more and found that some nice group of people created JDK 7 as a binary so someone like me can install it easily. It is called Open JDK: http://code.google.com/p/openjdk-osx-build/

所以,我下载了.dmg文件并安装它。然后我打开Java Preference并看到OpenJDK7可用。

So, I downloaded the .dmg file and install it. Then I open "Java Preference" and see that OpenJDK7 is available.

所以,现在我觉得我可以开始尝试使用WatchService API了。从第一个链接的教程中,作者首先给出了一个.java文件来测试它并确保它正在运行。以下是该文件的链接:
http: //download.oracle.com/javase/tutorial/essential/io/examples/WatchDir.java

So, now I feel that I can start trying out WatchService API. From the tutorial in the first link, the author gave a .java file to test it out first and make sure that it is running. Here is the link to the file: http://download.oracle.com/javase/tutorial/essential/io/examples/WatchDir.java

所以,我启动Eclipse(实际上我使用它) STS)并创建一个新的Java项目并在使用执行环境JRE:中选择JaveSE-1.7。在src文件夹下,我复制粘贴了WatchDir.java文件。

So, I boot up Eclipse (actually I use STS) and create a new Java project and choose JaveSE-1.7 in the "use an execution environment JRE:". Under the src folder, I copy pasted the WatchDir.java file.

我仍然看到大量波浪形的红线。所有import.java.nio。*都是红色的,我无法将其作为Java应用程序运行。

And I still see tons of squiggly red lines. All the "import.java.nio.*" are all red and I cannot run it as a Java app.

我需要做什么?

推荐答案

Oracle发布了 OS X的JDK 7

Oracle has released JDK 7 for OS X.

这篇关于如何在Mac OSX上使用JDK 7?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆