Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Troubles with importing java package to scala project (IntelliJ 10.5.2)

Trying to add "import" statement to my new scala project (I'm using IntelliJ 10.5.2 right now) syntax highlighter tells me that he cannot find java package:

import java.util.zip //Cannot resolve symbol java

object Main extends App {

    override def main(args: Array[String]) {

    }
}

What's wrong. What should I do to import this package?

like image 620
franza Avatar asked Oct 07 '11 16:10

franza


People also ask

How to import multiple classes from a Java package in Scala?

If you want to import multiple classes from a Java package, you can use the usual Java import syntax: or you can use this Scala import syntax, if you prefer: import javax.swing.

Why my project JDK is not compatible with Scala or SBT?

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.

Why can’t I compile my Scala project?

Why am I unable to compile my Scala project? 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.

Does IntelliJ IDEA support the SBT's model of integration tests?

Does IntelliJ IDEA support the sbt's model of integration tests? When you build sbt projects, keep in mind that the IDEA project model doesn't really have the same concept of configurations as sbt does, so only compile and test are fully supported. For other cases we recommend that you run the build from the integrated sbt shell.


1 Answers

Make sure that you have a Java SDK configured under:

File -> Project Structure -> Project -> Project SDK

See Where do I configure project JDK

like image 153
retronym Avatar answered Nov 09 '22 02:11

retronym