'tools.jar' seems to be not in CLion classpath - but JAVA_HOME is set (IntelliJ works fine as well)


Disclaimer: I have read the other questions around a similar issue and they don't work for me. In fact IntelliJ works for me, its just CLion that does not work for me.

I have JDK installed, and I do have tools.jar. JAVA_HOME is set correctly in my bashrc file (and in zshrc). IntelliJ works fine as well, something is broken in the CLion configuration on my box. Please assist.

I noticed that I dont have a config folder anymore for CLion in ~/Library/Preferences, so I copied IntelliJ2016.1 to CLion2017.3.1 (assuming that the internal idea.jdk file should be similar for CLion.). No luck.

I am a licensed customer, and have not been able to use the tool for a couple of months now!



@K4rthikr JRE is bundled with the CLion distribution, so you do not need to install Java on your computer to run CLion. What are you trying to do? Are you trying to use a custom JDK?



Set the system variable CL_JDK to the installed JDK path.

In my case it was CL_JDK="C:\Program Files\Java\jdk1.8.0_172" or CL_JDK=%JAVA_HOME%

Additional Details

This is a old question but this post is the first thing that came up on google so I'm answering it.

To figure this out I had to look through the installation files.

Inside [Clion install path]/bin/clion.bat (gist here) there's a bat file that can be used to run/debug the initialization process for clion.

Of critical importance is this line:

:: Locate a JDK installation directory which will be used to run the IDE.
:: Try (in order): CL_JDK, clion%BITS%.exe.jdk, ..\jre, JDK_HOME, JAVA_HOME.

Which means you can use the variable CL_JDK to override the JDK that clion uses.

Perhaps what is more strange is that if CL_JDK is not set Clion will eventually try to use its own prepackaged JRE to run which does not come with tools.jar from the JDK. Which is the reason you get this prompt:

Another notable caveat is that you have close IntelliJ IDEA (and possibly other instances of IntelliJ IDEs) to run Clion as Clion will prompt you with a message:


Okay, just found a rather hacky solution for this.

Go to Applications -> Right click on CLion -> Show Package Contents -> jdk -> Contents -> Home -> lib

This folder was empty for me. So I copied over all the files from $JAVA_HOME/lib to this directory and started CLion. And now it seems to be working.


This is just crazy.


Just in case: if you need to select the different JDK version the IDE will run under, please refer to this article.


Please sign in to leave a comment.