IntelliJ System.out.println() - Cannot resolve method println(java.lang.String)

Answered

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:

  1. reboot the pc
  2. restart IntelliJ.
  3. 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.

14 comments
Comment actions Permalink

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.

0
Comment actions Permalink

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?

 

0
Comment actions Permalink

> 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?

2
Comment actions Permalink

Thank you for Serge Baranov's help,I alse deal with the same question by this way.

0
Comment actions Permalink

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?

0
Comment actions Permalink

Please try File | Invalidate Caches | Invalidate and Restart.

0
Comment actions Permalink

'Invalidate Caches | Invalidate and Restart' Does not work. 

0
Comment actions Permalink

Double check the JDK configuration and classpath.

 

 

0
Comment actions Permalink

Surprisingly this is still a problem. I am using IntelliJIdea 2019.1 Build #IU191-6183.87. The 'Invalidate cache/restart' option dosent work either.

0
Comment actions Permalink

Try the current IDE version, reinstall JDK, configure it from scratch.

0
Comment actions Permalink

I have tried and installed java Jdk 13.01 still it doesn't work

0
Comment actions Permalink

@Fa18bscs0025 does the problem reproduce with JDK8?

0
Comment actions Permalink

I guess you just forgot this:

public static void main(String[] args) {}
1
Comment actions Permalink

Sil Hanheide 
Yes, this is the reason.

0

Please sign in to leave a comment.