For months now, I have been using IntelliJ IDEA to write my Java projects. I have always made them in the same directory, and never had any problems with the IDE.
However, after starting a new college course of OOP in Java, I decided to save all my college projects in a seperate directory. To my surpirse, IntelliJ IDEA simply REFUSED to compile any projects made here.
The specific error I get is:
Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main
Process finished with exit code 1
It suggests 'rebuilding the project', which results in the following:
Internal error (java.io.IOException): Cannot find IntelliJ IDEA project files at C:\IMPERIUM ROMANUM\Fakultet Tehnickih Nauka\Semestar II\Objektno Orijentisano Programiranje I\Vežbe\VEZBE_00 et VEZBE_01\Vezbe01
java.io.IOException: Cannot find IntelliJ IDEA project files at C:\IMPERIUM ROMANUM\Fakultet Tehnickih Nauka\Semestar II\Objektno Orijentisano Programiranje I\Vežbe\VEZBE_00 et VEZBE_01\Vezbe01
at org.jetbrains.jps.model.serialization.JpsProjectLoader.loadProject(JpsProjectLoader.java:124)
at org.jetbrains.jps.model.serialization.JpsProjectLoader.loadProject(JpsProjectLoader.java:101)
at org.jetbrains.jps.model.serialization.impl.JpsSerializationManagerImpl.loadModel(JpsSerializationManagerImpl.java:23)
at org.jetbrains.jps.cmdline.JpsModelLoaderImpl.loadModel(JpsModelLoaderImpl.java:34)
at org.jetbrains.jps.cmdline.BuildRunner.load(BuildRunner.java:68)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:347)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:193)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:211)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1589)
Please perform full project rebuild (Build | Rebuild Project)
This is incredibly frustrating, since we are talking about the simplest possible "Hello World" code, which has 0 complexity and doesn't even use any other classes except Main.
What's funny is that this same code compiles perfectly through the command prompt with
javac Main.java
and runs without any issues with
java Main
Does anyone have any similar experiences? Why is IntelliJ behaving like this, while working fine in all previous projects?