IntelliJ IDEA tells me “Error:java: Compilation failed: internal java compiler error idea”

前端 未结 12 912
梦谈多话
梦谈多话 2020-12-13 08:17

When I compile a Java project using IntelliJ IDEA, it gives me the following output (and error):

Information:Eclipse compiler 4.6.2 was used to compile java          


        
相关标签:
12条回答
  • 2020-12-13 08:48

    In JIdea 2020.1.2 and above,

    This is may be the language-level set in Project Structure is not compatible with the target byte-code version.

    You have to change the target bytecode version .

    1. Go to Settings [ Ctrl+Alt+S ]
    2. Select Java Compiler
    3. Select module in the table
    4. Change the byte-code version to map what you selected in the previous step for language-level

    NOTE : How to check the language-level

    1. Go to Project Structure [ Ctrl+Alt+Shift+S ]
    2. Select Modules sub section
    3. Select each module
    4. Under sources-section, check Language Level

    0 讨论(0)
  • 2020-12-13 08:52

    In my case, it was response type in restTemplate:

    ResponseEntity<Map<String, Integer>> response = restTemplate.exchange(
            eurl,
            HttpMethod.POST,
            requestEntity,
            new ParameterizedTypeReference<>() { <---- this causes error
            }
    );
    

    Should be like this:

    ParameterizedTypeReference<Map<String, Integer>> responseType = new ParameterizedTypeReference<>() {};
    
    ResponseEntity<Map<String, Integer>> response = restTemplate.exchange(
            url,
            HttpMethod.POST,
            requestEntity,
            responseType
    );
    
    0 讨论(0)
  • 2020-12-13 08:57

    I had the same problem. I fixed changing my settings. Target bytecode version for equals Project bytecode version.

    0 讨论(0)
  • 2020-12-13 08:59
    1. On Intellij IDEA Ctrl + Alt + S to open settings.
    2. Build, Execution, Deployment -> Compiler -> Java Compiler
    3. choose your java version from Project bytecode version
    4. Uncheck Use compiler from module target JDK when possible
    5. click apply and ok.
    0 讨论(0)
  • 2020-12-13 09:03

    You have to disabled the Javac Options: Use compiler from module target JDK when possible.

    0 讨论(0)
  • 2020-12-13 09:07

    In my case it was because of lombok library with intellij 2019.2 & java11.

    According to this IDEA bug after workaround idea works again:

    Disable all building from intelliJ and dedicate the build to Maven.

    0 讨论(0)
提交回复
热议问题