IntelliJ insists on running unit tests with JDK 8

I installed the preview and no amount of fiddling will keep IJ from using it to compile and run unit tests.

I have gone into the Run/Debug Configurations. I changed the default to 'Alternate JRE' and selected 1.6 and also tried to set it on an individual run configuration.



Not sure that completely understand the case, but do you ever need JDK 8 for your project? Check Project Structure dialog / Project section / Project SDK property. Set JDK 6, if you're Ok with it.



I installed the 8 preview so I could mess around with it. I have that in one project and that's fine.

Now I am back in another project and IntelliJ insists on running the unit tests of the other project using JDK 8, which makes it fail with version number errors.

The strange thing is that IntelliJ is definitely NOT being started with 8. When I do java -version I see 1.6, because I put the /usr/libexec/java_home line in my .bash_profile and it worked. What doesn't make sense to me is the project SDK in Project Structure is 1.6. I made a runner and set that to 1.6. I made the default JUnit runner 1.6. IntelliJ runs the test with 1.8.


Probably should have mentioned this is a Play project so I have Scala defined. I thought that might be the problem, but when I run the test at the play console with test-only it works fine and if I do sbt clean and then sbt test that works fine too.


I've created
Feel free to vote and comment.

Thank you,


Please sign in to leave a comment.