-1

I do not know why it cannot found main class. In fact, I use terminal to run this, it works.

Error

enter image description here

Niklas Rosencrantz
  • 23,939
  • 70
  • 214
  • 404
Eve_ltz
  • 21
  • 2

1 Answers1

1

The error message is more precisely:

Error: Could not find or load main class Test

Emphasis mine. In the top-right corner, notice the dropdown labeled "Test", with a small red cross on it. That's the currently active run configuration. It's a previous configuration that you used that's no longer valid.

An easy way to run this program is using keyboard shortcuts:

  1. Place the cursor inside the main method
  2. Press Control Shift F10 at the same time

This will create a new run configuration, to execute the class you are currently in. After this is done, observe the label on the dropdown in the top-right corner change to "HelloWorld", the name of your class.

janos
  • 115,756
  • 24
  • 210
  • 226