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:
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. What can I do to make it use JDK 1.7 ?
You can change the jdk used to compile your project in File/Project Structure/SDKs/Java SDK
(see here ).
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 ). If you still get the same error message, you can pass -source 7
in the javac
options.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.