Intellij IDEA设置:无法解析符号println

时间:2015-10-15 16:36:25

标签: java scala intellij-idea

Intellij为scala代码提供了这个错误:

    Cannot resolve symbol "println"

项目设置:

Project SDK:

  Intellij IDEA Community Edition IC-141.2735.5(openjdk version "1.8")

项目语言水平:

  8 - Lambdas, type annotations etc. 

平台设置:

SDKs:

   1.8   /usr/lib/jvm/java-8-openjdk-amd64

   IntelliJ IDEA Community Edition IC-141.2735.5

全球图书馆:

   scala-sdk-2.11.6

编辑:

编译器报告println有多个实现:

    scala-lang:scala-library:2.11.6.jar
    scala-lang:scala-library:2.11.6.jar

这是什么意思?

2 个答案:

答案 0 :(得分:0)

我不知道它是否仍然相关,但我遇到了同样的问题。对我来说,只需重新添加Scala SDK" Global Libraries":使用红色减号删除它,然后使用绿色加号再次添加Scala SDK。

干杯

答案 1 :(得分:-1)

public class Nurse extends Employee {
    public Nurse(boolean working, long id, String name, String department) {
        super(working, id, name, department);

        // here println can be resolved. Because it's inside of a function.
        System.out.println("Invoking constructor "); 
    }

   // System.out.println("Some messge "); // here println can't be resolved.
}