简体   繁体   中英

Fail to run Java code (by opening a project) with Intellij IDEA

I am new to the IDE. I have installed Java SE Development Kit 13.0.1 and set it as my JDK installation.

I opened a project (.java file) and the code was successfully shown. But the main run is greyed out and I can't run my code.

May I know how can I solve it? Thanks for your help!

屏幕

I think, your source folder is not specified as a source folder. To fix this, do the following:

Go to modules(in the Project Structure menu)

Select your source folder(likely src )

Click on source folder above it.

The source directory should be blue.

Save the changes(click ok to close it)

It should work.

I'm not so sure about that (its kind of a bug that sometimes happens), but try putting your mouse on the "main" in the main function and then hit ctrl + Enter and choose run.

hope this helps

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