0

I have set the Module SDK to 1.6

enter image description here

I have also set the Project SDK to 1.6

enter image description here

and I also change Java compiler options from setting to use java 6

enter image description here

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 Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode)

and my JAVA_HOME is also set to same.

Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289

2 Answers2

1

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:

    enter image description here

    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 at HKEY_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
Ashutosh Jindal
  • 18,501
  • 4
  • 62
  • 91
0

Try setting your IDEA_JDK_64 environment variable to point to your java SDK you want intelliJ to use for example 'D:\Programs\Java\jdk1.9'.

I encountered this issue when installing the new java 9 early access jdk and trying to run it on intelliJ 15.

This fixed it on IntelliJ 16 EAP versions.

Albert Scholtz
  • 337
  • 3
  • 15