0

For the below code, IntelliJ IDEA CE report "Cannot resolve symbol 'String' "

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}

I checked settings in the Project Structure, it is:

Project SDK: 16 Azul Zulu Community Version 16.0

project language level: 16-records, patterns, local enums and interfaces

For Platform Settings:

SDKs: JDK home path :/Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home

My maven setting is also checked, which is correct.

In preferences, Maven home path: /opt/apache-maven-3.8.12

User settings file: /opt/apache-maven-3.8.12/conf/settings.xml

$ mvn -v
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: /opt/apache-maven-3.8.12
Java version: 16.0.1, vendor: Azul Systems, Inc., runtime: /Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home
Default locale: zh_AU_#Hans, platform encoding: UTF-8
OS name: "mac os x", version: "11.3.1", arch: "aarch64", family: "mac"

Could anyone tell me how to solve the problem?

Kabang
  • 7
  • 1
  • >JDK home path :/Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home< Please show how and where you set JAVA_HOME. – g00se Jul 14 '21 at 10:47
  • It is now a common problem from IntelliJ, no matter wich operating system do you use. Have a look at https://stackoverflow.com/questions/63521181/java-file-outside-of-source-root-intellij/64340331 You have to try out serveral things to solve it. – Reporter Jul 14 '21 at 10:47
  • Does this answer your question? [Java file outside of source root intelliJ](https://stackoverflow.com/questions/63521181/java-file-outside-of-source-root-intellij) – Reporter Jul 14 '21 at 10:48
  • Is this `HelloWorld` .java file in a regular IntelliJ project? Did you download a JDK for ARM 64-bit (Apple Silicon) rather than for x86 (Intel)? Plus, I notice that the Azul Systems download for Azul Zulu community builds is currently at Java 16.0.2+7 (Zulu 16.32.15), later than your version. – Basil Bourque Aug 19 '21 at 21:30
  • @g00se Setting `JAVA_HOME` is not usually needed by default on macOS. – Basil Bourque Aug 19 '21 at 21:35
  • Well you don't know - until something needs it. Actually no different to any other OS – g00se Aug 19 '21 at 21:47

0 Answers0