[英]Start using Java out of the box on Mac OS X
My 10.5.3 install on a MacBook doesn't seem to want to build an example from Sun. 我在MacBook上安装10.5.3似乎不想从Sun构建示例 。 It claims it can't find java.io.Console to import.
它声称它无法找到要导入的java.io.Console。 This is annoying to me, and after much searching I can't figure out what I should do to fix it.
这对我来说很烦人,经过多次搜索后我无法弄清楚我应该怎么做才能修复它。
I have installed the Apple Developer Tools. 我已经安装了Apple Developer Tools。
Here's what happens: 这是发生的事情:
macbook:~ dlamblin$ javac RegexTestHarness.java
RegexTestHarness.java:32: cannot find symbol
symbol : class Console
location: package java.io
import java.io.Console;
^
RegexTestHarness.java:39: cannot find symbol
symbol : class Console
location: class RegexTestHarness
Console console = System.console();
^
RegexTestHarness.java:39: cannot find symbol
symbol : method console()
location: class java.lang.System
Console console = System.console();
^
3 errors
mmyers已经暗示过这一点,但听起来你还没有升级到Java 6.你可以从这里得到它: http : //support.apple.com/downloads/Java_for_Mac_OS_X_10_5_Update_4
I assume you have already installed Java 6 on your machine, because java.io.Console
is a Java 1.6 class. 我假设你已经在你的机器上安装了Java 6,因为
java.io.Console
是一个Java 1.6类。 I have run into cases where I update OS X to Java 6, but when run from a command line, the older version is still used. 我遇到过将OS X更新为Java 6的情况,但是从命令行运行时,仍然使用旧版本。 This has happened even after adjusting the Java Preferences app (Applications > Utilities > Java Preferences).
即使在调整Java Preferences应用程序(Applications> Utilities> Java Preferences)之后,也会发生这种情况。
Here is how I worked around it. 这是我如何解决它。
$ cd /System/Library/Frameworks/JavaVM.framework/Versions
$ sudo rm CurrentJDK
$ sudo ln -s 1.6.0 CurrentJDK
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.