IntelliJ Scala配置问题 [英] IntelliJ Scala configuration issue

查看:86
本文介绍了IntelliJ Scala配置问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我下载了Scala并配置了路径,可以从终端运行Scala控制台,安装了Scala插件,并且"hello world"正在运行 ...

So, I downloaded Scala and configured paths, I can run Scala console from terminal, Scala plugin is installed and "hello world" is running...

问题在于,当我编写一个"hello world"程序时:

The problem is that, when I write a "hello world" program:

object First {
   def main(args: Array[String]): Unit = {
      println(12)
   }
}

它说:Cannot resolve symbol println

正如我说的,我可以运行该程序,它会打印出12个...另外,如果我创建一个List或一个数组,它无法解析符号",但是一切运行都没有问题...

As I said, I can run this program and it prints out 12... Also, if I create a List or an array it "cannot resolve symbol" but everything runs with no problem at all...

在大多数情况下,我发现Java设置存在问题,但事实并非如此...

In most cases I've found, there was problem with Java set up, but that's not the case here...

推荐答案

文件-> 项目结构内,请确保在中有一个scala库.项目设置 \ 或者,请确保已将scala-compiler.jar,scala-library.jar添加到您的项目中.

Within File->Project Structure, make sure that there is a scala library in Project Settings\Libraries Or, make sure that you have added scala-compiler.jar, scala-library.jar to your project.

如果仍然运行异常,请尝试文件-> 使缓存无效/重新启动

If it is still acting strange, try File->Invalidate Cache/Restart

对于我启动的SBT项目,IntelliJ也有类似的问题,它具有正确安装的Scala 2.11库等.InvalidateCache对其进行了修复,以便IntelliJ可以找到符号.

I had a similar issue with IntelliJ for an SBT project I started, with a correctly installed Scala 2.11 library, etc. Invalidate Cache fixed it so that IntelliJ could find the symbols.

这篇关于IntelliJ Scala配置问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆