简体   繁体   English

无法在 Eclipse 中运行 Scala 代码

[英]Unable to run Scala code in eclipse

I am very new to scala and I am trying to run a simple code.我对 Scala 很陌生,我正在尝试运行一个简单的代码。 How ever I am getting this prompt asking for main class and I dont know to get around it.我怎么会收到这个要求主课的提示,但我不知道如何绕过它。 I have attached a screenshot.我附上了截图。 Any help would be greatly appreciated任何帮助将不胜感激

在此处输入图片说明

EDIT编辑

I have removed package greeting and yet the problem persists我已经删除了包裹问候语,但问题仍然存在在此处输入图片说明

My workspace loks like this我的工作区看起来像这样

在此处输入图片说明

When I try to run it looks like this当我尝试运行时,它看起来像这样在此处输入图片说明

For Eclipse your package in your Scala file should match your folder structure, otherwise it will not find your main.对于 Eclipse,您的 Scala 文件中的package应该与您的文件夹结构相匹配,否则它将找不到您的 main.cfg 文件。

So either put the scala file in a folder called greeter or remove package greeter .因此,要么将 scala 文件放在名为greeter的文件夹中,要么删除package greeter

I am pretty sure this is a bug in the Scala IDE.我很确定这是 Scala IDE 中的一个错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM