Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Scala configuration issue

Tags:

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

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

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

it says: Cannot resolve symbol println

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

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

like image 389
Sven Vidak Avatar asked Sep 01 '14 02:09

Sven Vidak


People also ask

How do I enable Scala in IntelliJ?

To install Scala plugin, press Ctrl+Alt+S , open the Plugins page, browse repositories to locate the Scala plugin, click Install and restart IntelliJ IDEA. Now you can successfully check out from VCS, create, or import Scala projects.

Why Scala class is not showing in IntelliJ?

On the Project pane on the left, right-click src and select New => Scala class. If you don't see Scala class, right-click on HelloWorld and click on Add Framework Support…, select Scala and proceed. If you see Error: library is not specified, you can either click download button, or select the library path manually.

How do I change the Scala version in IntelliJ?

 In most cases your project JDK is not compatible with Scala or sbt version, try to change the Scala Compile Server SDK. Press Ctrl+Alt+S to open Settings/Preferences dialog. From the options on the left, select Build, Execution, Deployment | Compiler | Scala | Scala Compiler Server.


1 Answers

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

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.

like image 195
larsonmattr Avatar answered Sep 22 '22 00:09

larsonmattr