http://stackoverflow.com/questions/18756469/intellij-idea-using-java7-compiler-to-compile-when-i-have-configured-it-to-use-j
我用了两个jdk,现在只保留jdk6就可以了,或者建一个新project,新的project就是用java6编译的了
|
I have set the Module SDK to 1.6
I have also set the Project SDK to 1.6
and I also change Java compiler options from setting to use java 6
but still it is using java 7 to compile. When I compile or run it gives following error
Using javac 1.7.0_11 to compile java sources
java:Errors occurred while compiling module 'SSLJava6'Compilation completed with 1 error and 0 warnings in 1 sec
1 error
0 warnings
java: javacTask: source release 1.7 requires target release 1.7
Has anyone faced such problem before? What must be done?
Output of java -version
[aniket@localhost jndiProperties]$ java -version
java version "1.6.0_30"Java(TM) SE RuntimeEnvironment(build 1.6.0_30-b12)JavaHotSpot(TM)64-BitServer VM (build 20.5-b03, mixed mode)
and my JAVA_HOME is also set to same.
|
|
|
|
Interesting.
Questions:
- Check that
c:\Users\$user\.IntelliJIdea12\config\options\jdk.table.xml has a reference to JDK6 only.
This is what the file looks like for me:
If there is a reference to a JDK 7 in there then delete the corresponding <jdk> element and restart Intellij.
- I know that you have confirmed the
java and javac path. Confirm the javac being used by writing a simple HelloWorld.java in a brand new Intellij project.
If in the new project javac6 is used, then it's an issue with the old project configuration.
- If there is a public JRE 7 lurking about, try un-installing it temporarily. After un-installation check that there is no cruft left behind in the Windows registry at
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
- Check whether the build fails if you rename the JDK7 home dir. If so, try symlinking the JDK7 dir to point to the Java6 installation dir. In the windows world the following will work to do the symlink :
mklink /J c:\Java7Home c:\ExistingJava6Home
|
分享到:
javac -version
show? And are you using maven to build? – maba Sep 12 '13 at 6:13