Im trying to compile some code in I\'m using Intellij Ultimate 13.1.4, but I get the following error and I have no idea what it means:
Information:Using java
Check your pom.xml
first (if you have one)
Check your module's JDK
dependancy. Make sure that it is 1.8
To do this,go to Project Structure -> SDK's
Add the path to where you have stored 1.8 (jdk1.8.0_45.jdk
in my case)
Apply the changes
Now, go to Project Structure ->Modules
Change the Module SDK to 1.8
Apply the changes
Voila! You're done
I add one more path unmentioned in this answer https://stackoverflow.com/a/26009627/4609353
but very important is Edit Configurations
I tried out all the steps mentioned in here https://stackoverflow.com/a/26009627/2058104, but the 4th point has now changed. You need to go to Preferences -> Build, Execution, Deployment -> Compiler -> Java Compiler
In there, as shown in below figure, you need to change the "Target bytecode version". Although, I changed it to 8 (since I needed to downgrade to Java 8), it was giving the same error, over and over. Therefore, try to remove the existing entry (in this table) and add it again. This worked for me.
On the other hand, clean the project and try to run again.
For Gradle users having this issues, if nothing above helps this is what solved my problem - apply this declarations in your build.gradle files:
targetCompatibility = 1.6 //or 1.7;1.8 and so on
sourceCompatibility = 1.6 //or 1.7;1.8 and so on
Problem solved!