To fix it: File > Project Structure > SDKs > 'IDEA jdk' > classpath > + > select C:\Program Files\Java\(jdk_version)\lib\tools.jar. 'When building the firs time I get an error: java: package does not exist ' => Make sure to add tools.jar to the 'IDEA jdk' configuration, as explained above.