首先,确认你安装了Java的1.8以上版本:

Microsoft Windows [版本 10.0.17134.590]
(c) 2018 Microsoft Corporation。保留所有权利。

C:\Users\adamhuan>java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) Client VM (build 25.191-b12, mixed mode)

C:\Users\adamhuan>

确认你的IntelliJ IDEA,装了scala的插件:

创建工程(Project)


这里,还需要下载scala的SDK包。


可以看到,这时候scala的SDK包就下好了。

我们继续:

这样,项目就创建好了。

编写代码:

文件:hello_world.scala

object hello_world extends App {
  println("Hello, world! scala!!")
}

运行:

运行结果:

"E:\Program Files\Java\jdk1.8.0_91\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2018.3.4\lib\idea_rt.jar=7189:C:\Program Files\JetBrains\IntelliJ IDEA 2018.3.4\bin" -Dfile.encoding=UTF-8 -classpath "E:\Program Files\Java\jdk1.8.0_91\jre\lib\charsets.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\deploy.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\access-bridge-64.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\cldrdata.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\dnsns.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\jaccess.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\jfxrt.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\localedata.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\nashorn.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\sunec.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\sunjce_provider.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\sunmscapi.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\sunpkcs11.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\zipfs.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\javaws.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\jce.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\jfr.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\jfxswt.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\jsse.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\management-agent.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\plugin.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\resources.jar;E:\Program Files\Java\jdk1.8.0_91\jre\lib\rt.jar;D:\IdeaProjects\scala_hellowolrd\out\production\scala_helloworld;C:\Users\adamhuan\.ivy2\cache\org.scala-lang\scala-library\jars\scala-library-2.12.8.jar;C:\Users\adamhuan\.ivy2\cache\org.scala-lang\scala-reflect\jars\scala-reflect-2.12.8.jar;C:\Users\adamhuan\.ivy2\cache\org.scala-lang\scala-library\srcs\scala-library-2.12.8-sources.jar;C:\Users\adamhuan\.ivy2\cache\org.scala-lang\scala-reflect\srcs\scala-reflect-2.12.8-sources.jar" hello_world
Hello, world! scala!!

Process finished with exit code 0

——————————————
Done。

说点什么

avatar

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

  Subscribe  
提醒