11

Let's make the long story short. Here is what happened:

  1. IntelliJ 12 CE downloaded and installed
  2. Latest Java 1.7/1.8 downloaded and installed
  3. JDK was setup to make and run the project

I faced the following strange error:

Error: java: System Java Compiler was not found in classpath

This was despite of the fact that I had Java 1.7/1.8 fully installed and had no problems working with it through the terminal.

AmirHd
  • 10,308
  • 11
  • 41
  • 60

3 Answers3

34

The solution that fixed my problem was as follows:

In:

Project Settings > Compiler > Java Compiler

I changed the drop down Use compiler from Javac to Eclipse!

Non of the other solutions I found on the web was helpful. Hope this helps you my unknown fellow reader.

IMPORTANT: THIS HAD NOTHING TO DO WITH MY JAVA_HOME AS IT WAS SET CORRECTLY.

AmirHd
  • 10,308
  • 11
  • 41
  • 60
  • 1
    Had the same issue with Java 1.8 too and this fixed it! Any reason why this works? – Molten Ice Jan 07 '16 at 13:55
  • 8
    This is ridiculous, but it works! In more recent version of IntelliJ (14.1.4): File->Settings->Build, Execution, Deployment->Compiler->Java Compiler->Use Compiler – Antonio Jun 06 '17 at 14:30
  • This worked for me albeit going through File settings and putting java compiler in the search bar for ubuntu. – user1821961 Jun 23 '18 at 02:47
2

You need to set environment variable JAVA_HOME. The IDE will check that variable on startup.

And enter the path to the home dir of installed JDK. Once it started it should point to the JDK used to run IDE. In this case the new compiler will be available among compilers already configured. You can always configure any new compiler using IDE compiler settings.

Roman C
  • 49,761
  • 33
  • 66
  • 176
0

i found that if you install vscode java plugin in your mac , IDEA will not work correctly. so disable the java plugins in vscode. Every thing gonna be alright