为什么 IcedTea6 不编译 Java 1.5 特定代码?
我跑了:
javac Perf.java
并得到:
ERROR in Prefs.java (at line 36)
HashMap<String, String> map = new HashMap<String, String>();
^^^^^^^^^^^^^^
Syntax error, parameterized types are only available if source level is 1.5
当我输入: java -version
我得到:
java version "1.6.0_0" IcedTea6 1.4 (fedora-11.b14.fc10-i386) Runtime Environment (build 1.6.0_0-b14) OpenJDK Client VM (build 14.0-b08, mixed mode)
javac -version
得到我:
Eclipse Java Compiler 0.883_R34x, 3.4.1 release, Copyright IBM Corp 2000, 2008. All rights reserved.
这是 Fedora 10 的全新安装。冰茶业务是什么? 为什么Java编译器默认为Eclipse编译器? 有人解释一下这种疯狂的行为吗?
I ran:
javac Perf.java
and got:
ERROR in Prefs.java (at line 36)
HashMap<String, String> map = new HashMap<String, String>();
^^^^^^^^^^^^^^
Syntax error, parameterized types are only available if source level is 1.5
When I type: java -version
I get:
java version "1.6.0_0" IcedTea6 1.4 (fedora-11.b14.fc10-i386) Runtime Environment (build 1.6.0_0-b14) OpenJDK Client VM (build 14.0-b08, mixed mode)
javac -version
gets me:
Eclipse Java Compiler 0.883_R34x, 3.4.1 release, Copyright IBM Corp 2000, 2008. All rights reserved.
This is a fresh install of Fedora 10. What is this icedtea business? Why is the Java compiler defaulting to the Eclipse compiler? Someone explain this madness...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查您的 $PATH 变量。 听起来你的“java”可执行文件在一个地方,而“javac”在其他地方。
在命令行上尝试“where”或“which”命令 - 这将告诉您 shell/操作系统在哪里找到每个可执行文件:
Check your $PATH variable. It sounds like your "java" executable is in one place and the "javac" is somewhere else.
Try the "where" or "which" command on the command line - this will tell you where the shell/OS is locating each of these executables:
Fedora 默认使用开源软件。 Icedtea 是 OpenJDK 的 Redhat 版本,完全开源。 Eclipse 编译器是最好的开源命令行 java 编译器,但它似乎默认不针对 Java 6 进行编译。
尝试“javac -help”来查看您有哪些选项。 它可能只是一个需要调整的简单环境变量。
Fedora as default use Open Source software. Icedtea is the redhat adaptation of the OpenJDK to be fully open source. The Eclipse compiler is the best open source command line java compiler out there, but it appears not to be compiling for Java 6 per default.
Try "javac -help" to see what options you have. It may be just a simple environment variable which needs tweaking.