IntelliJ System.out.println() - Cannot resolve method println(java.lang.String)
已回答
I am using IntelliJ IDEA, learning Java. All went well until yesterday, when the mentioned error occurred.
I didn't make any changes. I was looking for the solution the following ways:
- reboot the pc
- restart IntelliJ.
- delete the project directory and use another one (both on desktop)
nothing helps. buy running simple hello world method. It keeps showing this error:
I am not using any addon or
"Marven". it simply stops to work. And normally no import should be needed for println method. This error corrupted all my previous learning projects. So it doesn't seems to be local or connect to any single class.
请先登录再写评论。
Delete JDK configuration, add the new JDK, make sure this project has the correct JDK in its configuration (including the dependencies tab: http://www.jetbrains.com/idea/webhelp/configuring-module-dependencies-and-libraries.html). Verify that JDK classpath list has rt.jar file.
Please try File | Invalidate Caches | Invalidate and Restart.
delete JDK configuration? do you mean to uninstall JDK completely?
I can not quite follow "try File | Invalidate Caches | Invalidate and Restart." would you please explain?
> delete JDK configuration? do you mean to uninstall JDK completely?
No, just delete JSDK in IDEA and add it again.
> I can not quite follow "try File | Invalidate Caches | Invalidate and Restart." would you please explain?
Thank you for Serge Baranov's help,I alse deal with the same question by this way.
Hi there,
I just download IntelliJ idea after Netbeans, but when I just create a simple class, I faced a problem. Why is this happening?
Please try File | Invalidate Caches | Invalidate and Restart.
'Invalidate Caches | Invalidate and Restart' Does not work.
Double check the JDK configuration and classpath.
Surprisingly this is still a problem. I am using IntelliJIdea 2019.1 Build #IU191-6183.87. The 'Invalidate cache/restart' option dosent work either.
Try the current IDE version, reinstall JDK, configure it from scratch.
I have tried and installed java Jdk 13.01 still it doesn't work
@Fa18bscs0025 does the problem reproduce with JDK8?
I guess you just forgot this:
Sil Hanheide
Yes, this is the reason.
File | Invalidate Caches | Invalidate and Restart
this is not working in my case.
I have the same issue, "println" is cannot be resolved.
is there any alternative way?
Do you use Maven or Gradle? Does Build | Rebuild Project action complete successfully?
Try also using different JDK for the project.
Thank you. I tried with a Different JDK and I have deleted the Configuration and Configured a New One. It works fine for me Now.
and it is irrelevant to ask here but I'm Looking for a way out to fix this,
https://stackoverflow.com/questions/70769617/how-to-configure-google-oauth-and-form-auth-in-tom-cat-to-work-together-in-the-s
if u can answer this, that would be a great help for me. thank you in Advance.
I tried all of the options but not working
codingtillthe-end12
Please try File | Manage IDE Settings | Restore Default Settings…: https://i.imgur.com/kbrkC7w.png.
See also https://stackoverflow.com/a/61180376/104891.
Make sure .class file extension is not added in Settings | Editor | File Types | Ignored Files and Folders and is not mapped to some other file type.
Thank you for the solution.
Before reinstalling the IDE or IDK just check once that you have not declared the println function in class outside of the methods as it doesn't works.