sabbie
sabbie

Reputation: 81

IntelliJ : Cannot resolve method 'run(java.lang.Class, String[])'

I've encountered a problem where on all of my applications, there's a red cross on the top right. I can run it, but the cross doesn't seem to go away.

I've opened the run/debug configurations and it says Warning : Main method not found. I don't understand why it's not found when I already have a corresponding main class and method for each and every application.

I tried to close the project, restarting IntelliJ, restarting my laptop, refreshing my desktop, refresh Gradle by clicking Reimport All Gradle Projects, rebuild the project and clicking Invalidate Caches / Restart. I also tried other suggestions I found on StackOverflow such as deleting the .idea folder. Nothing. The red cross still shows up. I've also realized that I do not have the out folder in all of my Applications.

edit run/debug configurations dialog

cannot resolve method 'run(java.lang.Class, String[])'

Upvotes: 8

Views: 10260

Answers (4)

Crown
Crown

Reputation: 71

I just set the language level to equal my SDK version at Project Structure. Finally, it is disappeared.

enter image description here

Upvotes: 7

Otobong Jerome
Otobong Jerome

Reputation: 506

File->Project structure ->SDKs

  • Choose JDK home path, if no jdk is in the path,
  • you'll see an icon download jdk
  • download then ok

Upvotes: 6

Arjang
Arjang

Reputation: 729

In Project Settings, First make sure SDK path is correct. Preferably install and use your own SDK. Then use the same SDK in Project and Modules in Project Settings.

Upvotes: 4

Valeriy K.
Valeriy K.

Reputation: 2904

Try to copy src and gradle folders and buil.gradle and settings,gradle files in separate folder. Then open this new folder as new project in intellij. Then intellij will propose Import as gradle project... - push it. If problem remained see you build.gradle

Upvotes: 0

Related Questions