Intellij IDEA 使用 java7 compiler to compile 转为java6

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.

share | improve this question
 
   
What does javac -version show? And are you using maven to build? –   maba  Sep 12 '13 at 6:13
   
javac -version shows also shows javac 1.6.0_30 and no I am not using maven. –   Aniket Thakur  Sep 12 '13 at 6:35
   
Which version of IntelliJ? 12.1.4 ? –   vikingsteve  Sep 12 '13 at 8:07 
   
Maybe you also have some dependencies set on SSLJava6? –   gorex  Sep 12 '13 at 8:40
   
@vikingsteve yes it's 12.1.4 –   Aniket Thakur  Sep 12 '13 at 8:59

1 Answer

Interesting.

Questions:

  1. 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.

  2. 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.

  3. 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 atHKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment

  4. 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
share | improve this answer
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值