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

查看:39
本文介绍了如何在 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 是 NIO 类的一部分,该类计划用于 JDK 7.因此,它处于 beta 形式.没关系.

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 创建为二进制文件,因此像我这样的人可以轻松安装它.它被称为开放 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天全站免登陆