0

Getting error Error: Could not find or load main class in intellij while running a java class, able to run the same through run Configurations

enter image description here the class highlighted is the one i want to run. Executes well when i am running it through Run configurations.

enter image description here

Mani shankar
  • 35
  • 1
  • 5
  • With `javac` your classpath is probably not correctly set. IntelliJ will to that magic using Run configurations. – FaltFe Sep 07 '20 at 06:01

1 Answers1

0

Try going to the src/main/java directory and running javac com/Runners/TestRunnerMutliThreaded.java from there. Because of the package system, you have to do it this way (which I consider a good thing about java, but I won't have opinions). The package statement at the top of the class is the package of the class (obviously) which basically means if you compile it from another folder, that package might not be correct. If you want more info, look at this.

Higigig
  • 1,175
  • 1
  • 13
  • 25