0

I have a large project and I know I have errors in many files.

1- I have cleared the class containing main() function from errors.

2- I build the project and because of errors only some the classes (including the one with main function) are compiled.

3- I have activated "Build, no error check" in my run configuration.

4- The class with main function is selected as the Main class of the project.

As soon as I press the run, all compiled files (.class) are removed from the output folder and therefore I receive the error: Error: Could not find or load main class xxxx

I am using Intellij community 2019-3.

Thank you

wmac
  • 1,023
  • 1
  • 16
  • 34

1 Answers1

1

If your main class has classes which were not compiled - it will not be compiled also. You need to recompile file by file or use Eclipse compiler. See this answer: https://stackoverflow.com/a/16784855/2000323 which basically duplicates your.

Andrey
  • 15,144
  • 25
  • 91
  • 187
  • I removed every reference to other classes in my Main class... I also used build to partially compile the code and I have already enabled "Build, no error check" The question you mention, does not have the problem I have (removal of compiled files) – wmac May 14 '20 at 11:34
  • The answer to the question I posted has: `Make also deletes output class files for the sources with errors`. So if the main class has errors **or** it has reference to classes with erros - it will not work. Unless you switch to Eclipse compiler. – Andrey May 14 '20 at 13:31
  • It still would delete the compiled class files. The only method I could find was to totally remove "build" and "Build with no error check". Now I should build manually and run (which will not run any build task and does not remove anything). Thank you very much. – wmac May 14 '20 at 20:36