简体   繁体   中英

eclipse could not find main class

I am trying to run a java program that has 3 classes and an .aj file. I have my main named Main.class.

When I'm trying to run my program it says it could not find my main class, even though it's right there.

爪哇

Eclipse is trying to run prob1.Main which doesnt exist. By looking at your class you commented the package name. Try recompiling your class again and run it.

Don't comment out the:

  package prob1;

The only time you don't need to write the package is when you are using the default package for a project (which is created automatically when you create a class in a new project). Edit the code snippet and then run the program again and it should be fine. Hope this helps.

SomeTimes eclipse get corrupted run configuration...... For that issue three solution is there

  1. Go to Run configuration setting , inside JAva Apllication you find your project, click on that, on right panel re-path you main class file path
  2. if 1st doesn't work,take a backup of your main class ,delete it and re create new main class ,and copy the code from back up
  3. if 2nd failed .Close eclipse. Delete the .metadata directory. Start eclipse. Import the projects. Run the project again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM