2

When I tried to Run a .java file during the build I got the following Error

Module 'JAVA-Workspace' production: java.lang.ClassCastException: class org.jetbrains.jps.builders.java.dependencyView.TypeRepr$PrimitiveType cannot be cast to class org.jetbrains.jps.builders.java.dependencyView.TypeRepr$ClassType (org.jetbrains.jps.builders.java.dependencyView.TypeRepr$PrimitiveType and org.jetbrains.jps.builders.java.dependencyView.TypeRepr$ClassType are in unnamed module of loader java.net.URLClassLoader @490d6c15)

'JAVA-Workspace' is my project directory. It was fine a few minutes ago I was debugging the same file. I did not install any new plugins at the time. Java 11 | Intellj Version

I tried :

  • Remove caches and indexes by Invalidate and Restart < Invalidate Caches < File.
  • Delete .idea in root directory of the project.

Thank You

abhinit21
  • 330
  • 1
  • 4
  • 13
  • 1
    Check if this helps: https://stackoverflow.com/questions/64336525/how-do-i-fix-an-error-in-intellij-that-prevents-me-from-running-my-projects – pringi Feb 21 '22 at 09:27
  • @pringi I saw that thread. Noting working for him too. He replied wait for the next update . . . – abhinit21 Feb 21 '22 at 09:31
  • 1
    What version of Intellij, what version of java? Try also to run from command line and check the errors you obtain. I think the problem will be related with Java modules. See this: https://stackoverflow.com/questions/67782975/how-to-fix-the-module-java-base-does-not-opens-java-io-to-unnamed-module – pringi Feb 21 '22 at 09:41
  • 1
    Have you tried creating a new project with just your source code to see if that builds? Or reinstalling IntelliJ? – Siddiqui Feb 21 '22 at 10:49
  • not i have not tried to re-install yet . . . I want to understand the error too. I will do if nothing works. – abhinit21 Feb 21 '22 at 18:33
  • 1
    @abhinit21 did you manage to find out what the issue was or how to fix it? Same thing happened to me, was working fine and suddenly this without any changes. – Mr.O Sep 24 '22 at 13:13
  • 1
    @Mr.O in my case I have deleted the build output folder "target" and then re-build the project solved the issue I have got help from -> intellj https://youtrack.jetbrains.com/issue/IDEA-289413/Build-Failed-While-saving-caches-Java-11 – abhinit21 Sep 25 '22 at 14:15

0 Answers0