Have a Java project, which is setup to build a .jar file.
Java 1.7 is installed, and have set the project to Language Level 6.
However, it keeps compiling the jar files (via the artifact builder) to Java 1.7, so I get the following error when trying to run on a Java 1.6 JVM:
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/mycompany/myproject/MyClass : Unsupported major.minor version 51.0
Under
File
->Other Settings
->Default Settigns...
->Compiler
, I've set "Project bytecode version" to 1.6,Also tried setting "Additional command line parameters" to
-target 1.6
and-source 1.6
Have also added this line to
~/.bash_profile
(so thatjava -version
returns1.6.0_65
) and restarting IntelliJ:export JAVA_HOME=
/usr/libexec/java_home -v '1.6*'
But IntelliJ still keeps building the jar to Java 7, and it fails to run on JVM 1.6. What might I try next?