Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

intellij idea internal java compiler error

I am running a simple pattern matcher program exactly as in test_harness

Information:java: Errors occurred while compiling module 'demo_java8'
Information:javac 1.8.0_121 was used to compile java sources
Information:2018-02-06 10:15 - Compilation completed with 1 error and 0 warnings in 376ms
Error:java: Compilation failed: internal java compiler error

However terminal command javac xxx.java and java xxx run properly.

Running the first hello world program gives the same error.

like image 266
Tiina Avatar asked Feb 06 '18 02:02

Tiina


People also ask

How do I fix a compilation error in IntelliJ?

Invalidate Caches/Restart. Delete user config. Create a new project (trying to see if my current project files somehow all got messed up, but the problems persist even with new projects) Uninstall + Reinstall.

How do I know which IntelliJ Compiler I have?

Press Ctrl+Alt+S to open the IDE settings and select Build, Execution, Deployment| Compiler.

What Java Compiler does IntelliJ use?

IntelliJ IDEA comes bundled with the Eclipse compiler. Groovy-Eclipse.

Why is IntelliJ not showing compilation errors?

In "Settings" --> Build, Execution, Deployment --> "Compiler" check the checkbox "Build project automatically". This will immediately show any compile errors in the project tree.


2 Answers

In my case, the issue is resolved by adding a type parameter object to a class instance that needed it. In the following code replaced new ParameterizedTypeReference<> with new ParameterizedTypeReference<Map<String, Object>>

return getRestTemplate().exchange(uri,
                                  HttpMethod.POST,
                                  new HttpEntity<>(headers),
                                  new ParameterizedTypeReference<Map<String, Object>>() {

                                  });
like image 171
Vijay Nandwana Avatar answered Sep 26 '22 16:09

Vijay Nandwana


It turned out that "odd" error description is because of maven plugin was missing. And it's default was 1.5 while Console class is only available since 1.6. Instead of jar or class cannot be found, it gives a blur description internal java compiler error. Information:javac 1.8.0_121 was used to compile java sources was a hint that the javac version and sdk version mismatch. Besides, I was surprised that intellij idea run function uses maven build (I thought it was just for cli) .

like image 20
Tiina Avatar answered Sep 22 '22 16:09

Tiina