简体   繁体   中英

Having problem with running main method in IntelliJ

After changing my default project directory, when I try to run the main method, I have to manually add new configuration on Run/Debug tab on IntelliJ to actually run the main method. At first, I didn't think of it as an issue because that isn't really much of work, but it happens every time I create a new project.

Is there any way to solve the problem?

Some things you can try:

  • Just run the application once using the play button in front of the class wrapping the main funtion. Usually in a file named SomethingSomethingApplication.java .

  • Try File > Repair IDE . Then just follow the steps in the messages at the bottom right.

  • Close the project and delete all the *.iml and the .idea folder. Then open the project using the .pom instead of the project folder.

All the times that we start a new project and configure Run/Debug, in general, all the conf files to run/debug project are in the ".idea" folder inside the root of your directory. So the solution is investigate the why the content of this folder is not persisting or changing. Maybe: Some broken conf content in ".idea" folder, try do delete this folder to force IntelliJIDEA create new one.

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