如何在Intellij Idea 10中运行Scala代码 [英] How to run Scala code in Intellij Idea 10
问题描述
我有一个简单的问题。我安装了idea和scala插件。
创建项目并添加想要运行简单 println(Hello world!)
。
I have simple problem. I installed idea and scala plugin.
Create project and add wants to run simple println("Hello world!")
.
I创建scala脚本。添加此行。当我运行它时,我有错误预期的类或对象定义
。
I create "scala script". Add this line. And when i run it, i have error expected class or object definition
.
我怎样才能运行它看到输出?
How can i can run it and see the output?
谢谢
推荐答案
您还可以将Scala对象转换为脚本。只需删除文件中的所有声明,只保留可执行语句 - println(Hello,World!),然后按上述说明运行脚本。
You can also turn your Scala object into a script. Just remove all declarations from the file, leave the executable statement only - println("Hello, World!"), and run the script as described above.
但是我确认它的结果与您引用的错误相同。我认为这是一个错误(或不准确的文档),提交错误,Jetbrains的人非常积极地开发这个插件。
However I confirm that it results with the same error as you quoted. I think this is a bug (or inaccurate documentaion), file a bug, Jetbrains guys are developing this plugin very actively.
这篇关于如何在Intellij Idea 10中运行Scala代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!