Laurent Hinoul

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” - John F. Woods

How to fix Fatal error compiling: invalid target release: 1.8

This tutorial is writen for mac users, on windows I didn’t have this error.

When I tried to do a mvn compile. I got the following error:

You will get this error because you asked maven to compile in a higher JDK then your current JDK is. To see what your current JDK is, type the following command in your terminal:

When I typed this command, I got the following result:

What, 1.6? But if I run java -version, I got 1.8… Now, to fix this, open a second terminal. There you type the following commands:

After I did that, my result was:

I want jdk1.8.0_25.jdk to be my current JDK, so I changed the current JDK by the following command:

If you copy/paste this code, don’t forget to change the JDK version to yours! Now If you run the code below again, you will notice that 1.8 is your current JDK now.

Try a mvn compile again and enjoy 😀

2 comments for “How to fix Fatal error compiling: invalid target release: 1.8

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: