Reputation: 51
While trying to run tests, I ran into this compilation error:
I tried researching this on Google and here, and after applying all of the solutions that worked for others this issue still persists. Here is what I have done so far:
I think this issue may have something to do with a discrepancy between the JDK and the compiler.
When I run java -version
from the terminal it returns 1.8.0_111. However when I run javac -version
it returns 1.7.0_79. I looked for ways to force change the javac version to match the java version but nearly all of them reference update-alternatives
which is not available for Mac OS or removing /usr/bin which is not allowed (even with sudo) on El Capitan.
Workaround Edit:
I was able to bypass the issue by going to Preferences -> Build, Execution, Deployment -> Compiler -> Java Compiler and changing the compiler from "javac" to "Eclipse" and I am able to compile my project.
Upvotes: 5
Views: 12876
Reputation: 1838
On IntelliJ:
IntelliJ Settings - Gradle Configuration Image
Upvotes: 1
Reputation: 5361
The solution that helped me:
Under Build, Execution, Deployment > Build Tools > Gradle > Runner
Change Run tests using: from Platform Test Runner to Gradle Test Runner:
Upvotes: 0
Reputation: 51
I was able to successfully compile my project by going into Preferences -> Build, Execution, Deployment -> Compiler -> Java Compiler an changing the "use compiler" option from Javac to Eclipse.
Upvotes: 0
Reputation: 21
Try to change java version at the terminal, try this:
change-java 8
Upvotes: 1