Could not find or load main class

后端 未结 16 1243
隐瞒了意图╮
隐瞒了意图╮ 2020-11-27 20:27

I have Windows 7, installed jdk1.7.0 and its supporting jre7.
My problem is compilation part works perfectly, but while running the Java program I get this error saying:

16条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-27 20:52

    I had almost the same problem, but with the following variation:

    1. I've imported a ready-to-use maven project into Eclipse IDE from PC1 (project was working there perfectly) to another PC2
    2. when was trying to run the project on PC 2 got the same error "Could not find or load main class"
    3. I've checked PATH variable (it had many values in my case) and added JAVA_HOME variable (in my case it was JAVA_HOME = C:\Program Files\Java\jdk1.7.0_03) After restarting Ecplise it still didn't work
    4. I've tried to run simple HelloWorld.java on PC2 (in another project) - it worked
    5. So I've added HelloWorld class to the imported recently project, executed it there and - huh - my main class in that project started to run normally also.

    That's quite odd behavour, I cannot completely understand it. Hope It'll help somebody. too.

提交回复
热议问题