Eclipse can't find / load main class

前端 未结 20 2088
猫巷女王i
猫巷女王i 2020-12-05 04:40

My Eclipse (Indigo) was running just fine. I created a simple class Hello. It is placed in package cont in the folder ch13. However

相关标签:
20条回答
  • 2020-12-05 04:53

    .metadata is corrupted.

    Steps:

    Warning: Deleting .metadata will delete all your Eclipse configurations, plugins, project setups. Make a backup before you attempt this!

    1. Stop eclipse, delete .metadata in workspace and restart eclipse

    2. Import Project

    3. Run again

    0 讨论(0)
  • 2020-12-05 04:54

    Standard troubleshooting steps for Eclipse should include deleting and re-importing the project at some point, which when I have dealt with this error has worked.

    0 讨论(0)
  • 2020-12-05 04:56

    I found the way to fix this problem was to rename the project. If you give it a name with strange characters (in my case, :), it will have trouble locating your class. I don't know if this rule applies to numbers, but try renaming the project or making a new one and copying the files. Name it without any numbers or special characters.

    0 讨论(0)
  • 2020-12-05 04:56

    I read so many blogs and tried so many tricks but my problem not resolved. I was able to run the code but not able to generate the jar file. :( Sad..

    But I tried something which might be very silly but worked for me and bought eclipse on trace. What I did was.. Just deleted the main method from the class. Saved it. Did undo to bring the main class back. Tada... Issue resolved... Just one think would like to say, keep your eclipse in "Build Autometically" mode.

    0 讨论(0)
  • 2020-12-05 04:56

    I had the same problem.I solved with following command maven:

    mvn eclipse:eclipse -Dwtpversion=2.0

    PS: My project is WTP plugin

    0 讨论(0)
  • 2020-12-05 04:57

    If you are using a pre-defined run configuration, go to classpath and try "Restore Default Entries". This will reconfigure the classpath for that configuration.

    0 讨论(0)
提交回复
热议问题