在运行scala项目时遇到错误 [英] faces error in running the scala project
问题描述
可能重复:
运行eclipse中scala的配置
请帮助这次我我正在运行一个scala项目并且出现错误:
please help me this time. I am running a scala project and got an error:
在main.scala.controls.MyServer中找不到main类。 p>
could not find main class in: main.scala.controls.MyServer.
我正在运行main.scala,有一个名为MyServer的对象。是否有必要为它创建一个类。请回复
I'm running main.scala and there is a object of name MyServer. Is it necessary to create a class for it. Please respond
推荐答案
我正在运行main.scala,有一个名为MyServer的对象。是否有必要为它创建一个类。
I'm running main.scala and there is a object of name MyServer. Is it necessary to create a class for it.
不,你不需要创建一个类。所有你需要的是一个具有 main
方法的对象:
No, you don't need to create a class. All you need is an object with a main
method:
def main(args: Array[String]): Unit = { println("hello") }
提供更多信息:代码,如何尝试运行它,构建系统,IDE等。
Anyway, provide more info: code, how you try to run it, building system, IDE, etc.
这篇关于在运行scala项目时遇到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!