Error java compilation failed internal java compiler error

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 sources Information:Module "sinoWeb" was

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 sources
Information:Module "sinoWeb" was fully rebuilt due to project configuration/dependencies changes
Information:2017/3/23 11:44 - Compilation completed with 1 error and 0 warnings in 5m 32s 949ms
Error:java: Compilation failed: internal java compiler error

I’m quite confused confused by this! Below are my settings:

enter image description

enter image description here

Toastrackenigma's user avatar

asked Mar 23, 2017 at 3:46

ieatczp's user avatar

5

  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.

answered Oct 31, 2018 at 10:58

Musab Bozkurt's user avatar

Musab BozkurtMusab Bozkurt

1,5711 gold badge6 silver badges5 bronze badges

5

I solved this issue by increasing the default value(700) of Build process heap size on IntelliJ’s compiler settings.

enter image description here

answered Feb 2, 2018 at 15:17

sezerug's user avatar

sezerugsezerug

1,0969 silver badges10 bronze badges

1

I changed my compiler to Eclipse and run my project. Afterwards changed back to Javac and problem solved. I don’t know exact problem but it can help who is looking for solution.

intellij java compiler

answered Jul 24, 2017 at 7:41

omerhakanbilici's user avatar

omerhakanbiliciomerhakanbilici

8641 gold badge19 silver badges26 bronze badges

2

In my case, using Java 11, I had:

 public List<String> foo() {
   ...
   return response.readEntity(new GenericType<List<String>>() {});

and Intellij suggested I should use <> instead of GenericType<List<String>>, as such:

 public List<String> foo() {
   ...
   return response.readEntity(new GenericType<>() {});

I did that in four functions and the project stopped compiling with an internal compiler error, reverted and it compiled again. Looks like a bug with type inference.

answered Jul 26, 2019 at 7:16

Tony BenBrahim's user avatar

Tony BenBrahimTony BenBrahim

6,9522 gold badges38 silver badges48 bronze badges

3

For me the module’s target bytecode version was set to 5. I changed it to 8 and the error is gone:

module's bytecode version setting

answered Apr 17, 2020 at 10:40

velocity's user avatar

velocityvelocity

1,50019 silver badges23 bronze badges

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

enter image description here

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

enter image description here

answered Aug 8, 2020 at 3:04

prime's user avatar

primeprime

13.9k13 gold badges92 silver badges127 bronze badges

1

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.

enter image description here

answered Sep 16, 2019 at 10:27

Filomat's user avatar

FilomatFilomat

6831 gold badge11 silver badges15 bronze badges

3

Per-module bytecode version settings

I met the same problem

I solved it by changing the Target bytecode error from 1.5 to 8

Brad Mace's user avatar

Brad Mace

27k17 gold badges99 silver badges146 bronze badges

answered Jan 9, 2021 at 9:49

kl w's user avatar

kl wkl w

811 silver badge2 bronze badges

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

Maximilian Ast's user avatar

answered Apr 17, 2019 at 14:04

Duc Hiep Hoang's user avatar

0

In my case, it was response type in restTemplate:
enter image description here

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
);

answered May 19, 2020 at 9:38

dev_in_progress's user avatar

dev_in_progressdev_in_progress

2,4542 gold badges22 silver badges32 bronze badges

1

It May is not be relevant to this case, but:

I got this error when I change the Explicit type argument List of:

new ParameterizedTypeReference<List<SomeDtoObject>>()

to <> :

new ParameterizedTypeReference<>()

in restTemplate call after Intellij gave the warning to use <> instead.

It got fixed when I undo my changes back into the Explicit type argument.

answered May 3, 2022 at 18:00

Jay Ehsaniara's user avatar

Changing the Language Level in the Project Settings (Ctrl + Alt + Shift + S) to Java 8 solved the problem for me

answered Jul 27, 2018 at 7:52

Chris K.'s user avatar

Chris K.Chris K.

1,0508 silver badges10 bronze badges

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

enter image description here

answered Jun 15, 2020 at 21:30

Thiago de Melo Fontana's user avatar

What worked for me is to update the Open JDK version

answered Jun 17, 2020 at 11:26

NobuhleM's user avatar

I got the same error with Community edition 2020.3 on Windows 10 with an older version of the JDK (openjdk version «11» 2018-09-25).

Updating the JDK to javac 11.0.10 fixed the issue.

Here’s the stack trace that showed up with the error when using openjdk version «11» 2018-09-25:

java: compiler message file broken: key=compiler.misc.msg.bug arguments=11, {1}, {2}, {3}, {4}, {5}, {6}, {7}
java: java.lang.AssertionError
java:   at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
java:   at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
java:   at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$2$1.setOverloadKind(DeferredAttr.java:172)
java:   at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.visitReference(ArgumentAttr.java:283)
java:   at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMemberReference.accept(JCTree.java:2190)
java:   at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.attribArg(ArgumentAttr.java:197)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.attribArgs(Attr.java:751)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1997)
java:   at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1634)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:655)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3573)
java:   at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2110)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:2006)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.visitReturn(Attr.java:1866)
java:   at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1546)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:724)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:743)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1294)
java:   at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1020)
java:   at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:498)
java:   at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:481)
java:   at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculativeLambda(DeferredAttr.java:456)
java:   at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.canLambdaBodyCompleteNormally(DeferredAttr.java:900)
java:   at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.visitLambda(DeferredAttr.java:878)
java:   at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1807)
java:   at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.complete(DeferredAttr.java:832)
java:   at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:335)
java:   at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode.process(DeferredAttr.java:779)
java:   at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrContext.complete(DeferredAttr.java:626)
java:   at jdk.compiler/com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:214)
java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:605)
java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1563)
java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1733)
java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1802)
java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1776)
java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve$10.doLookup(Resolve.java:2654)
java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3293)
java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3543)
java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2651)
java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2645)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.selectSym(Attr.java:3721)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3601)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2598)
java:   at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$4.complete(DeferredAttr.java:374)
java:   at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:321)
java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve$MethodResultInfo.check(Resolve.java:1060)
java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve$4.checkArg(Resolve.java:887)
java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve$AbstractMethodCheck.argumentsAcceptable(Resolve.java:775)
java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve$4.argumentsAcceptable(Resolve.java:896)
java:   at jdk.compiler/com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:181)
java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve.checkMethod(Resolve.java:644)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:4120)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.checkIdInternal(Attr.java:3913)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethodIdInternal(Attr.java:3814)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.checkId(Attr.java:3803)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3696)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2595)
java:   at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode.process(DeferredAttr.java:811)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:3553)
java:   at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2243)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:702)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1773)
java:   at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1452)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1098)
java:   at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:866)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4683)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4574)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4523)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4503)
java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:4448)
java:   at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1341)
java:   at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
java:   at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
java:   at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
java:   at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
java:   at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
java:   at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:231)
java:   at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:501)
java:   at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:353)
java:   at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:277)
java:   at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:231)
java:   at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1441)
java:   at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1100)
java:   at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1224)
java:   at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1066)
java:   at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:832)
java:   at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:419)
java:   at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:183)
java:   at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:132)
java:   at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:302)
java:   at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:132)
java:   at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:219)
java:   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
java:   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
java:   at java.base/java.lang.Thread.run(Thread.java:834)
java: Compilation failed: internal java compiler error
java: Errors occurred while compiling module 'project'
javac 11 was used to compile java sources
Finished, saving caches...
Compilation failed: errors: 1; warnings: 100

answered Apr 3, 2021 at 23:17

Pradyumna Revur's user avatar

enter image description here

Setting -> Build -> Compiler -> Java Compiler
The Target bytecode version of the module is wrong. I set it to 1.8, then it worked.

answered Jul 6, 2021 at 5:54

rosa's user avatar

rosarosa

713 bronze badges

In my case I had to go to help > show logs in files which opens up the idea.log and build-log folders something like

/home/user/.cache/JetBrains/IntelliJIdea2021.2/log/build-log/ where I set the log level to DEBUG in the log4j.rootLogger=debug, file in build-log.properties

I then ran build again and saw

2021-11-27 19:59:39,808 [ 133595]  DEBUG - s.incremental.java.JavaBuilder - Compiling chunk [module] with options: "-g -deprecation -encoding UTF-8 -source 11 -target 11 -s /home/user/project/target/generated-test-sources/test-annotations", mode=in-process
2021-11-27 19:59:41,082 [ 134869]  DEBUG - s.incremental.java.JavaBuilder - java:ERROR:Compilation failed: internal java compiler error

which lead me to see that this might me related to junit test compilation failing. It turns out I had an older/mismatching of the vintage engine and the jupiter engine which are likely to have different java versions relating in the error above. Changing them to be the same ${version.junit} removed the error.

  <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
            <version>1.6.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-commons</artifactId>
            <version>1.7.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${version.junit}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <version>${version.junit}</version>
            <scope>test</scope>
        </dependency>

In short some of your dependency jars may have mismatching java versions.

answered Nov 27, 2021 at 19:27

Gridcell Coder's user avatar

1

Was facing the same issue with Java 11. Solved by changing language level

File -> Project Structure -> Project

Change «Language Level» to SDK Default

enter image description here

answered Aug 10, 2022 at 17:35

Harshvardhan Chittora's user avatar

Updated Java compiler to correct «Target bytecode version» which in my case is 8 :

enter image description here

answered May 6, 2021 at 10:25

blue-sky's user avatar

blue-skyblue-sky

50.9k146 gold badges414 silver badges721 bronze badges

one reason may be jdk version donot macth minimal version of your project.

answered Jul 16, 2021 at 3:41

user13243683's user avatar

1

Be aware of JDK-8177068 issue, which leads to internal error like

java.lang.NullPointerException
        at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitApply(Flow.java:1233)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1628)
        at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:393)
        at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitExec(TreeScanner.java:213)
        ...

It was fixed in JDK 11.0.12 and JDK 14 b14, so upgrade helped.

answered Aug 10, 2021 at 12:52

Nikita Bosik's user avatar

Nikita BosikNikita Bosik

8371 gold badge14 silver badges20 bronze badges

I switched across to the cmd line mvn compile build and it showed a more meaningful error.

Fatal error compiling: error: invalid target release: 17 -> [Help 1]

Checking my JAVA_HOME it was set to 11. Once I adjust my project to use 11 as well I got past this and onto another error (which was solved separately).

answered Aug 22, 2022 at 10:57

Shane Gannon's user avatar

Shane GannonShane Gannon

6,1707 gold badges37 silver badges59 bronze badges

Otherwise you can remove .m2 folder. Try to reload project.

answered Oct 8, 2022 at 20:39

Ali Can's user avatar

1

In my case, I was using Spring Framework 6.0.0 and JDK 11 as the same time. This is not supported according to spring framework wiki. After I degraded the spring framework version to 5.3.24, it solved.

You can check your spring framework version in this way.
spring framework version

answered Dec 13, 2022 at 6:08

Jarvan Lee's user avatar

Programming has become far easier as compared to what it used to be back in the day. That said, it’s still fairly difficult and random bugs and glitches are the order of the day. 

In this article, we’re talking about the “Java: compilation failed: internal java compiler error” problem when compiling code in Java, its causes and what you can do to fix the issue. 


What causes this error?

There are a number of different reasons why your Java compilation might fail, some of the most common ones being.

  • Outdated Java compiler
  • Wrong or corrupt JDK installation.
  • Incorrect installation path.

Also read: How to fix ‘Runtimeerror: cudnn error: cudnn_status_not_initialized’?


How to fix this?

Here are six solutions you can try out. 

Restart the IDE

One of the first things you should do is try and restart the IDE. More often than not, IDE caches fill up with random files and failed builds over the course of development and restarting can help clear it out, especially if you’re getting build or compilation errors without any reason in particular. 

Top 10 programming languages to learn in 2019


Rebuild the project

Sometimes, the best way around compilation errors is to just try again. Trying a fresh build with the cache files removed and the previous builds cleared can give you a successful compilation. 


Try using the terminal

To isolate the issue from your IDE, you can try compiling your code in the terminal (Command Prompt if you’re on Windows) to see if the issue lies in your code, the JDK or your IDE. 

To do so, just navigate to the directory where your code is in and run the following command. 

javac filename.java

If the compilation is successful, you most likely have an issue with your IDE rather than JDK or your code. 


Update JDK

Updating your JDK version can also help get rid of uncalled-for compilation issues. Head over to Oracle’s JDK download page and download the x64 installer for the latest JDK version (18.0.2.1 at the time of writing). Install the downloaded installer once the download is complete. 

A JNI error has occurred in Minecraft: 3 Fixes

You can check out our detailed guide on how to install Java on Windows here and Linux here. 

Update your IDE

Another potential fix for the situation can be updating your IDE. As JDK versions and compilers update, your IDE also needs to update to keep up with the latest changes. Using an outdated IDE with a newer version of a programming language it doesn’t exactly support is a recipe for disaster. Not only will you have a horrible code writing experience, but you’ll also run into compatibility issues and build errors like this one. 


Give the compiler more storage

Also called the build process heap size, increasing this gives the compiler more headroom when building a program and avoids memory errors. Whether you’re using IntelliJ, BlueJ, NetBeans or Eclipse, most IDEs do have this setting (albeit named differently). 

Also read: How to fix ‘Internal exception java.net.socketexception connection reset realms’?

Yadullah Abidi

Someone who writes/edits/shoots/hosts all things tech and when he’s not, streams himself racing virtual cars.

You can contact him here: [email protected]

Содержание

  1. How to fix ‘Java: compilation failed: internal java compiler error’?
  2. What causes this error?
  3. How to fix this?
  4. Restart the IDE
  5. Rebuild the project
  6. Try using the terminal
  7. Update JDK
  8. Update your IDE
  9. Give the compiler more storage
  10. Русские Блоги
  11. 「IDEA」Error:java: Compilation failed: internal java compiler error
  12. Проверьте, соответствуют ли эти три места версии SDK самого проекта.
  13. Попробуйте снова!
  14. Проблема с установленным JDK!
  15. Интеллектуальная рекомендация
  16. Реализация оценки приложения iOS
  17. JS функциональное программирование (е)
  18. PWN_JarvisOJ_Level1
  19. Установка и развертывание Kubernetes
  20. На стороне многопроцессорного сервера — (2) *
  21. Русские Блоги
  22. Ошибка IDEA Ошибка: Java: ошибка компиляции: внутренняя ошибка компилятора Java
  23. Интеллектуальная рекомендация
  24. Реализация оценки приложения iOS
  25. JS функциональное программирование (е)
  26. PWN_JarvisOJ_Level1
  27. Установка и развертывание Kubernetes
  28. На стороне многопроцессорного сервера — (2) *
  29. IntelliJ IDEA сообщает мне «Ошибка: Java: Ошибка компиляции: идея внутренней ошибки компилятора Java»
  30. IntelliJ IDEA сообщает мне «Ошибка: Java: Ошибка компиляции: идея внутренней ошибки компилятора Java»
  31. 23 ответа

How to fix ‘Java: compilation failed: internal java compiler error’?

Programming has become far easier as compared to what it used to be back in the day. That said, it’s still fairly difficult and random bugs and glitches are the order of the day.

In this article, we’re talking about the “Java: compilation failed: internal java compiler error” problem when compiling code in Java, its causes and what you can do to fix the issue.

What causes this error?

There are a number of different reasons why your Java compilation might fail, some of the most common ones being.

  • Outdated Java compiler
  • Wrong or corrupt JDK installation.
  • Incorrect installation path.

How to fix this?

Here are six solutions you can try out.

Restart the IDE

One of the first things you should do is try and restart the IDE. More often than not, IDE caches fill up with random files and failed builds over the course of development and restarting can help clear it out, especially if you’re getting build or compilation errors without any reason in particular.

Rebuild the project

Sometimes, the best way around compilation errors is to just try again. Trying a fresh build with the cache files removed and the previous builds cleared can give you a successful compilation.

Try using the terminal

To isolate the issue from your IDE, you can try compiling your code in the terminal (Command Prompt if you’re on Windows) to see if the issue lies in your code, the JDK or your IDE.

To do so, just navigate to the directory where your code is in and run the following command.

If the compilation is successful, you most likely have an issue with your IDE rather than JDK or your code.

Update JDK

Updating your JDK version can also help get rid of uncalled-for compilation issues. Head over to Oracle’s JDK download page and download the x64 installer for the latest JDK version (18.0.2.1 at the time of writing). Install the downloaded installer once the download is complete.

Update your IDE

Another potential fix for the situation can be updating your IDE. As JDK versions and compilers update, your IDE also needs to update to keep up with the latest changes. Using an outdated IDE with a newer version of a programming language it doesn’t exactly support is a recipe for disaster. Not only will you have a horrible code writing experience, but you’ll also run into compatibility issues and build errors like this one.

Give the compiler more storage

Also called the build process heap size, increasing this gives the compiler more headroom when building a program and avoids memory errors. Whether you’re using IntelliJ, BlueJ, NetBeans or Eclipse, most IDEs do have this setting (albeit named differently).

Someone who writes/edits/shoots/hosts all things tech and when he’s not, streams himself racing virtual cars.

You can contact him here: [email protected]

Источник

Русские Блоги

「IDEA」Error:java: Compilation failed: internal java compiler error

При импорте нового проекта произошла следующая ошибка:

Error:java: Compilation failed: internal java compiler error

Давайте сначала проверим несколько мест:

Проверьте, соответствуют ли эти три места версии SDK самого проекта.

Попробуйте снова!

Обычно ее можно решить идеально, выполнив вышеуказанные шаги, но есть исключения .

Если сообщается о той же ошибке, вероятно .

Проблема с установленным JDK!

Удалите исходный JDK, перейдите на официальный сайт Java, чтобы загрузить подлинный JDK, сбросьте переменные среды и повторите попытку!

Автор загрузил поддельный JDK с китайского сайта загрузки, проработал N часов и, наконец, использовал официальный JDK, и, наконец, обнаружил, что это проблема JDK!

Желаю всем удачного кодирования!

Интеллектуальная рекомендация

Реализация оценки приложения iOS

Есть два способа получить оценку приложения: перейти в App Store для оценки и оценка в приложении. 1. Перейдите в App Store, чтобы оценить ps: appid можно запросить в iTunes Connect 2. Встроенная оцен.

JS функциональное программирование (е)

Давайте рассмотрим простой пример, чтобы проиллюстрировать, как используется Reduce. Первый параметр Reduce — это то, что мы принимаем массив arrayOfNums, а второй параметр — функцию. Эта функция прин.

PWN_JarvisOJ_Level1

Nc первый Затем мы смотрим на декомпиляцию ida Перед «Hello, World! N» есть уязвимая_функция, проверьте эту функцию после ввода Видно, что только что появившийся странный адрес является пе.

Установка и развертывание Kubernetes

На самом деле, я опубликовал статью в этом разделе давным -давно, но она не достаточно подробно, и уровень не является ясным. Когда я развернулся сегодня, я увидел его достаточно (хотя это было успешн.

На стороне многопроцессорного сервера — (2) *

Обработка сигнала Родительский процесс часто очень занят, поэтому вы не можете просто вызвать функцию waitpid, чтобы дождаться завершения дочернего процесса. Затем обсудите решение. Обратитесь .

Источник

Русские Блоги

Ошибка IDEA Ошибка: Java: ошибка компиляции: внутренняя ошибка компилятора Java

Ошибка IDEA при выполнении программы

Проанализируйте, что исходному выпуску 1.8 требуется целевой выпуск 1.8, и похоже, что версии совпадают. Но компиляция все же пошла не так. Выполнение компиляции или пакета через maven — это нормально. Эта ошибка возникает только тогда, когда класс, в котором выбрана основная функция, запускается из IDEA. Вы можете определить, что должна быть проблема с настройкой версии Java проекта в IDEA. Определите проблему и начните видеть, что такое установка версии IDEA.

1. Настройки проекта и модуля для версии Java
Файл-> Структура проекта-> Параметры проекта-> Проект, убедитесь, что установлена ​​правильная версия. Авторский проект использует java8

2. ИДЕЯ настройка
Файл-> Настройки-> Сборка, Выполнение, Развертывание-> Компилятор Java, убедитесь, что версия выходных данных компиляции проекта — java8. Моя проблема здесь, она должна быть 1,8, и я не знаю, что Когда установлено на 1.6.

На данный момент проблема решена.
Чтобы подвести итог, запустите программу в IDEA, главным образом, если скомпилированная версия или синтаксис исходного кода не соответствуют версии Java, проверьте эти два места, чтобы убедиться, что версия исходного кода, версия для выполнения является Как и ожидалось.

Прикрепите часть maven. Когда возникает проблема с выполнением программы из IDEA, обычно выполняется компиляция или пакетирование только через maven.

Интеллектуальная рекомендация

Реализация оценки приложения iOS

Есть два способа получить оценку приложения: перейти в App Store для оценки и оценка в приложении. 1. Перейдите в App Store, чтобы оценить ps: appid можно запросить в iTunes Connect 2. Встроенная оцен.

JS функциональное программирование (е)

Давайте рассмотрим простой пример, чтобы проиллюстрировать, как используется Reduce. Первый параметр Reduce — это то, что мы принимаем массив arrayOfNums, а второй параметр — функцию. Эта функция прин.

PWN_JarvisOJ_Level1

Nc первый Затем мы смотрим на декомпиляцию ida Перед «Hello, World! N» есть уязвимая_функция, проверьте эту функцию после ввода Видно, что только что появившийся странный адрес является пе.

Установка и развертывание Kubernetes

На самом деле, я опубликовал статью в этом разделе давным -давно, но она не достаточно подробно, и уровень не является ясным. Когда я развернулся сегодня, я увидел его достаточно (хотя это было успешн.

На стороне многопроцессорного сервера — (2) *

Обработка сигнала Родительский процесс часто очень занят, поэтому вы не можете просто вызвать функцию waitpid, чтобы дождаться завершения дочернего процесса. Затем обсудите решение. Обратитесь .

Источник

IntelliJ IDEA сообщает мне «Ошибка: Java: Ошибка компиляции: идея внутренней ошибки компилятора Java»

Когда я компилирую проект Java с использованием IntelliJ IDEA, он дает мне следующий результат (и ошибку):

Меня это очень смущает! Ниже мои настройки:

  1. В Intellij IDEA Ctrl + Alt + S, чтобы открыть настройки.
  2. Сборка, выполнение, развертывание ->Компилятор ->Компилятор Java
  3. выберите свою версию java из версии байт-кода проекта
  4. Снимите флажок Использовать компилятор из целевого модуля JDK, когда это возможно.
  5. нажмите « Применить» и ОК .

Я решил эту проблему, увеличив значение по умолчанию (700) размера кучи процесса сборки в настройках компилятора IntelliJ.

Я сменил компилятор на Eclipse и запустил свой проект. Впоследствии вернулся к Javac, и проблема была решена. Я не знаю точной проблемы, но это может помочь тем, кто ищет решение.

В моем случае, используя Java 11, у меня было:

и Intellij предложила мне использовать <> вместо GenericType
> , как таковое:

Я сделал это в четырех функциях, и проект перестал компилироваться из-за внутренней ошибки компилятора, вернулся назад и снова скомпилировал. Похоже на ошибку с выводом типа.

В моем случае это было из-за lombok библиотеки с intellij 2019.2 и java11.

Согласно этой ошибке IDEA, идея обходного решения снова работает:

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

Для меня версия целевого байт-кода модуля была установлена ​​на 5. Я изменил ее на 8, и ошибка исчезла:

В JIdea 2020.1.2 и выше ,

Возможно, уровень языка, установленный в структуре проекта, несовместим с целевой версией байтового кода.

Вам необходимо изменить целевую версию байт-кода.

  1. Зайдите в настройки [Ctrl + Alt + S]
  2. Выберите компилятор Java
  3. Выбрать модуль в таблице
  4. Измените версию байт-кода, чтобы сопоставить то, что вы выбрали на предыдущем шаге для уровня языка

ПРИМЕЧАНИЕ: Как проверить уровень языка

  1. Перейти к структуре проекта [ Ctrl + Alt + Shift + S ]
  2. Выберите подраздел » Модули»
  3. Выберите каждый модуль
  4. В разделе источников проверьте уровень языка

Источник

IntelliJ IDEA сообщает мне «Ошибка: Java: Ошибка компиляции: идея внутренней ошибки компилятора Java»

Когда я компилирую проект Java с использованием IntelliJ IDEA, он дает мне следующий результат (и ошибку):

Меня это очень смущает! Ниже мои настройки:

23 ответа

В моем случае, используя Java 11, у меня было:

И Intellij посоветовал мне использовать <> вместо GenericType
> как таковое:

Я сделал это с помощью четырех функций, и проект перестал компилироваться из-за внутренней ошибки компилятора, вернулся назад и снова компилировался. Похоже на ошибку с выводом типа.

Я решил эту проблему, увеличив значение по умолчанию (700) Размер кучи процесса сборки в настройках компилятора IntelliJ.

Вы должны отключить параметры Javac: по возможности используйте компилятор из целевого модуля JDK.

В моем случае это был тип ответа в restTemplate :

Должно быть так:

Изменение уровня языка в настройках проекта (Ctrl + Alt + Shift + S) на Java 8 решило проблему для меня

В моем случае это было из-за библиотеки lombok с intellij 2019.2 и java11.

Согласно эта ошибка IDEA после того, как идея обходного пути снова работает:

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

Для меня версия целевого байт-кода модуля была установлена ​​на 5. Я изменил ее на 8, и ошибка исчезла:

Я сменил компилятор на Eclipse и запустил свой проект. Впоследствии вернулся к Javac, и проблема решена. Я не знаю точной проблемы, но это может помочь тем, кто ищет решение.

У меня сработало обновление версии Open JDK

  1. В Intellij IDEA Ctrl + Alt + S откройте настройки.
  2. Сборка, выполнение, развертывание ->Компилятор ->Компилятор Java
  3. выберите свою версию java из Версия байт-кода проекта
  4. Снимите флажок Использовать компилятор из целевого модуля JDK, когда это возможно .
  5. нажмите Применить и ОК .

В JIdea 2020.1.2 и более поздних версиях

Возможно, уровень языка, установленный в структуре проекта, несовместим с целевой версией байт-кода.

Вы должны изменить целевую версию байт-кода.

  1. Перейдите в Настройки [ Ctrl+Alt+S ]
  2. Выберите Компилятор Java .
  3. Выбрать модуль в таблице
  4. Измените версию байт-кода, чтобы сопоставить то, что вы выбрали на предыдущем шаге для уровня языка

ПРИМЕЧАНИЕ: Как проверить уровень языка

  1. Перейдите в Структура проекта [ Ctrl + Alt + Shift + S ]
  2. Выберите подраздел Модули .
  3. Выберите каждый модуль
  4. В разделе источников проверьте уровень языка .

Я столкнулся с той же проблемой

Я решил это, изменив ошибку байт-кода Target с 1,5 до 8.

У меня такая же проблема. Я исправил изменение своих настроек. Целевая версия байт-кода для равной версии байт-кода проекта.

Я получил ту же ошибку с Community edition 2020.3 в Windows 10 с более старой версией JDK (версия openjdk «11» 2018-09-25).

Обновление JDK до javac 11.0.10 устранило проблему.

Вот трассировка стека, которая обнаружилась с ошибкой при использовании openjdk версии «11» 2018-09-25:

В моем случае мне пришлось перейти к help > show logs in files , который открывает папки idea.log и build-log , что-то вроде

/home/user/.cache/JetBrains/IntelliJIdea2021.2/log/build-log/ , где я установил уровень журнала DEBUG в log4j.rootLogger=debug, file в build-log.properties

Затем я снова запустил сборку и увидел

Что привело меня к выводу, что это может быть связано с ошибкой компиляции теста junit. Оказывается, у меня был более старый/несоответствующий винтажный движок и движок Юпитера, которые, вероятно, имеют разные версии Java, связанные с ошибкой выше. Изменение их на одинаковые $ устранило ошибку.

Короче говоря, некоторые из ваших банок зависимостей могут иметь несоответствующие версии Java.

Источник

Hello,
I had the same problem with java (AdoptOpenJDK) 11.0.4.11-hotspot, IntelliJ 2019.2.3, Lombok 1.18.10 and lombok-plugin (0.26.2-2019.2).

For a while, I manage by choosing either building with IntelliJ or compiling with Maven. I have the ‘lombok’ and ‘mapstruct-processor’ dependencies and switch from one to the other, I have to add or remove from the maven compiler configuration the following the ‘annotationProcessorPaths’:

<annotationProcessorPaths> 
    <path>
         <groupId>org.projectlombok</groupId>
         <artifactId>lombok</artifactId>
         <version>1.18.10</version>
     </path>
 </annotationProcessorPaths>

This morning I made a mistake in my maven compiler configuration and now building with Intellij and compiling with maven works with the same configuration. Here is the mistake I made : instead of using the tag <path> I used <dependency> like this :

<annotationProcessorPaths> 
    <dependency>
         <groupId>org.projectlombok</groupId>
         <artifactId>lombok</artifactId>
         <version>1.18.10</version>
     </dependency>
 </annotationProcessorPaths>

I think that maven does not care what is the enclosing tag (you could use <abcdef> instead of <dependency>) but IntelliJ does.

Hope it helps someone.

Error phenomenon

The following exception information appears using IDEA to import a new project or upgrade IDEA or create a new project:

Error:java: Compilation failed: internal java compiler error 

wrong reason
The reason for this error is mainly because there are two reasons for JDK version, one is the compiling version does not match, one is the current project JDK version does not support.

View project JDK
File -> Project Structure-> Project Settings -> Project or use shortcuts Ctrl + Alt + Shift + S to open the JDK configuration:

See if this two are consistent with the target JDK.

View project JDK

Click Modules to view the corresponding JDK version in the figure above.

View Java Compiler Version

There is a lot of probability of problems everywhere in the Java project.

For this problem, the content in the POM file (Maven project) is remapped by re-opening or modifying the POM file (Maven Project) is likely to cause the JDK version to revert to 1.5. If it is a Maven project, you can specify JDK related information in the POM file:

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

Понравилась статья? Поделить с друзьями:
  • Error java source option 5 is no longer supported use 6 or later
  • Error java outofmemoryerror insufficient memory
  • Error java net unknownhostexception unable to resolve host
  • Error java lang verifyerror inconsistent stackmap frames at branch target 47
  • Error java awt