This issue is atleast 8 years old but has no clear solution till now and has been asked multiple times on SO relevant to different JDK installations again and again
the solutions proposed are no more relevant to latest Java releases since release 10 since the entire compiler structure has been revamped.
All the 3 solutions offered in the older QA
- setting JAVA_HOME correctly
- adding tools.jar to my maven dependency list
- running eclipse with correct vm
do not seem relevant/work anymore.
I tried all the above 3 with jdk 14 including adding the following dep to my pom as explained else where
<dependency>
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
What would be the ideal solution when using JDK 14 and above while my source / target version is set to 1.8