[英]JDK still pointing to 1.6 on Mac OSX 10.10.2
So I have been trying to compile my code and I get the following error: 所以我一直在尝试编译我的代码,但出现以下错误:
Information:Using javac 1.7.0_80-ea to compile java sources
Information:java: Errors occurred while compiling module 'DataRegistry'
Information:4/8/15, 9:48 AM - Compilation completed with 14 errors and 0 warnings in 2 sec
/Users/jvy234/Documents/workspace/dataregistry/src/main/java/com/capitalone/hub/registry/controller/SandboxController.java
Error:(169, 43) java: diamond operator is not supported in -source 1.6
(use -source 7 or higher to enable diamond operator)
I manually forced the CurrentSDK symlink to java 1.7: 我手动将CurrentSDK符号链接强制为Java 1.7:
6003088f811e:~ jvy234$ which java
/usr/bin/java
6003088f811e:~ jvy234$ ls -ltr /usr/bin/java
lrwxr-xr-x 1 root wheel 74 Jan 21 09:52 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
6003088f811e:~ jvy234$ ls -ltr /System/Library/Frameworks/JavaVM.framework/Versions/
total 64
lrwxr-xr-x 1 root wheel 10 Jan 21 09:52 1.6.0 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jan 21 09:52 1.6 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jan 21 09:52 1.5.0 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jan 21 09:52 1.5 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jan 21 09:52 1.4.2 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jan 21 09:52 1.4 -> CurrentJDK
lrwxr-xr-x 1 root wheel 1 Jan 21 09:52 Current -> A
drwxr-xr-x 7 root wheel 238 Jan 21 09:52 A
lrwxr-xr-x 1 root wheel 59 Apr 8 09:43 CurrentJDK -> /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/
When I go to my Preferences panel for Java I see Java 1.7_80 installed. 当我转到Java的“首选项”面板时,看到安装了Java 1.7_80。 What can I do to make it use JDK 1.7 ?
我该怎么做才能使其使用JDK 1.7?
You can change the jdk used to compile your project in File/Project Structure/SDKs/Java SDK
(see here ). 您可以
in File/Project Structure/SDKs/Java SDK
更改用于编译项目的jdk(请参阅此处 )。
If you wish to change the compiler of your entire workspace, you can change the compiler used in File/Settings/Build, Execution, Deployment/Compiler/Java Compiler
(see this doc page ). 如果要更改整个工作区的编译器,则可以更改在“
File/Settings/Build, Execution, Deployment/Compiler/Java Compiler
(请参见此文档页面 )。 If you still get the same error message, you can pass -source 7
in the javac
options. 如果仍然收到相同的错误消息,则可以在
javac
选项中传递-source 7
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.