Discussion:
Error in Eclipse :"Editor does not contain a main type"
Jochen Herrmann
2010-08-26 14:34:41 UTC
Permalink
Hi all,

I'm a newbie in Scala and had in the past not a lot with the C-world to do
so maybe I simply have overseen something,
but the below code compiles in Eclipse 3.5.2 (Scala IDE updated today)
with an error: "Editor does not contain a main type"
and I have no idea whats wrong .

package RationalPack
object MyMain {
def main(args:Array[String]){
val x=new Rational(49,13)
val y=new Rational(47,128)
println (x + "+" + y +"=" + x.+(y) )
println (x + "*" + y +"=" + x*y )
}
}
Any idea's / hints ?

TIA
Joe Herrmann
Jesper de Jong
2010-08-26 20:38:29 UTC
Permalink
Hello Jochen,

That error is not a compiler error, but an error from Eclipse itself; it
means that Eclipse doesn't see that your program has an entry point (the
main method).

Your program looks OK, you've declared the main method with the correct
signature, inside an object. It might be a bug in the IDE. I'm not using
Eclipse for Scala myself, so I can't tell you in more detail what to do
about it (I use NetBeans and the Scala plug-in that's available for it).

Jesper
Post by Jochen Herrmann
Hi all,
I'm a newbie in Scala and had in the past not a lot with the C-world to do
so maybe I simply have overseen something,
but the below code compiles in Eclipse 3.5.2 (Scala IDE updated today)
with an error: "Editor does not contain a main type"
and I have no idea whats wrong .
package RationalPack
object MyMain {
def main(args:Array[String]){
val x=new Rational(49,13)
val y=new Rational(47,128)
println (x + "+" + y +"=" + x.+(y) )
println (x + "*" + y +"=" + x*y )
}
}
Any idea's / hints ?
TIA
Joe Herrmann
--
Jesper de Jong
jespdj-***@public.gmane.org
Naftoli Gugenheim
2010-08-27 03:09:06 UTC
Permalink
That error only comes up when you click the default Run action. I think it's
a bug in the Scala IDE, but in any case the solution is to create a run
configuration and use it.


On Thu, Aug 26, 2010 at 10:34 AM, Jochen Herrmann
Post by Jochen Herrmann
Hi all,
I'm a newbie in Scala and had in the past not a lot with the C-world to do
so maybe I simply have overseen something,
but the below code compiles in Eclipse 3.5.2 (Scala IDE updated today)
with an error: "Editor does not contain a main type"
and I have no idea whats wrong .
package RationalPack
object MyMain {
def main(args:Array[String]){
val x=new Rational(49,13)
val y=new Rational(47,128)
println (x + "+" + y +"=" + x.+(y) )
println (x + "*" + y +"=" + x*y )
}
}
Any idea's / hints ?
TIA
Joe Herrmann
Zéide Peace
2010-08-27 04:46:24 UTC
Permalink
I've met with same problem.
And now, I use IntelliJ IDEA.
Post by Jochen Herrmann
Hi all,
I'm a newbie in Scala and had in the past not a lot with the C-world to do
so maybe I simply have overseen something,
but the below code compiles in Eclipse 3.5.2 (Scala IDE updated today)
with an error: "Editor does not contain a main type"
and I have no idea whats wrong .
package RationalPack
object MyMain {
def main(args:Array[String]){
val x=new Rational(49,13)
val y=new Rational(47,128)
println (x + "+" + y +"=" + x.+(y) )
println (x + "*" + y +"=" + x*y )
}
}
Any idea's / hints ?
TIA
Joe Herrmann
--
(≥ⓛㅅⓛ≀)
Ne perdez pas courage!
Ce n`est pas encore fini.
Jochen Herrmann
2010-08-27 07:40:58 UTC
Permalink
Thanks for your replies !

Have posted a ticket at scala-ide.org

Jesper, I think I will give Netbeans with Scala-Plugin a try. Is it less
complicated than Eclipse !?

Naftoli, sorry, I'm also new to Eclipse: How can I define a "run
configuratrion" in Eclipse and why do you assume that it would work ? A link
or hint would be great.

Zéide, I'm still learning and have not yet decided, whether I will use it
for my job or not. So I don't see the necessity to invest already money in
an IDE. I was told that Eclipse would be a professional IDE and bugs can
happen, especially if new software.

Joe Herrmann
Miles Sabin
2010-08-27 08:39:10 UTC
Permalink
On Fri, Aug 27, 2010 at 8:40 AM, Jochen Herrmann
Post by Jochen Herrmann
Thanks for your replies !
Have posted a ticket at scala-ide.org
Thanks ... from the looks of it it's an easily fixable configuration issue.

The best place for this discussion is the Scala IDE user list,

http://groups.google.com/group/scala-ide-user

Cheers,


Miles
--
Miles Sabin
tel: +44 7813 944 528
gtalk: miles-XKJT71GPLR04Q++***@public.gmane.org
skype: milessabin
http://www.chuusai.com/
http://twitter.com/milessabin
Jesper de Jong
2010-08-27 09:50:16 UTC
Permalink
You can get NetBeans from http://netbeans.org/

You can get the Scala plug-in for NetBeans from
http://sourceforge.net/projects/erlybird/files/nb-scala/6.9v1.1.0/

Installation instructions for the plug-in here:
http://wiki.netbeans.org/Scala68v1
(those are for NetBeans 6.8, but for 6.9 it's the same).

I can't tell you if it's more or less complicated than Eclipse. The NetBeans
plug-in does have some bugs, but at the moment there isn't a Scala IDE which
is bugfree and has just as much functionality as is available for Java.

Besides Eclipse and NetBeans there is IntelliJ IDEA, which apparently has a
good Scala plug-in: http://www.jetbrains.com/idea/
(the Community Edition is free).

Jesper
<http://sourceforge.net/projects/erlybird/files/nb-scala/6.9v1.1.0/>
Post by Jochen Herrmann
Thanks for your replies !
Have posted a ticket at scala-ide.org
Jesper, I think I will give Netbeans with Scala-Plugin a try. Is it less
complicated than Eclipse !?
Naftoli, sorry, I'm also new to Eclipse: How can I define a "run
configuratrion" in Eclipse and why do you assume that it would work ? A link
or hint would be great.
Zéide, I'm still learning and have not yet decided, whether I will use it
for my job or not. So I don't see the necessity to invest already money in
an IDE. I was told that Eclipse would be a professional IDE and bugs can
happen, especially if new software.
Joe Herrmann
--
Jesper de Jong
jespdj-***@public.gmane.org
Razvan (Pub) Cojocaru
2010-08-27 13:01:41 UTC
Permalink
In the run menu, click on the "run configurations" at the bottom and
will see the list of all programs you've run so far - just create a
new one and manually type in the class name.
Post by Jochen Herrmann
Thanks for your replies !
Have posted a ticket at scala-ide.org
Jesper, I think I will give Netbeans with Scala-Plugin a try. Is it less
complicated than Eclipse !?
Naftoli, sorry, I'm also new to Eclipse: How can I define a "run
configuratrion" in Eclipse and why do you assume that it would work ? A link
or hint would be great.
Zéide, I'm still learning and have not yet decided, whether I will use it
for my job or not. So I don't see the necessity to invest already money in
an IDE. I was told that Eclipse would be a professional IDE and bugs can
happen, especially if new software.
Joe Herrmann
--
Sent from my mobile device
Guofeng Zhang
2010-08-27 09:02:57 UTC
Permalink
I use Scala IDE, M2Eclipse and m2eclipse-scala, and use Run or Run As to launch any Scala code without meeting the problem.



From: Zéide Peace [mailto:***@gmail.com]
Sent: Friday, August 27, 2010 12:46 PM
To: Jochen Herrmann
Cc: scala-***@listes.epfl.ch
Subject: Re: [scala-user] Error in Eclipse:"Editor does not contain a main type"



I've met with same problem.
And now, I use IntelliJ IDEA.

2010/8/26 Jochen Herrmann <***@gmail.com>

Hi all,

I'm a newbie in Scala and had in the past not a lot with the C-world to do so maybe I simply have overseen something,
but the below code compiles in Eclipse 3.5.2 (Scala IDE updated today) with an error: "Editor does not contain a main type"
and I have no idea whats wrong .

package RationalPack

object MyMain {
def main(args:Array[String]){
val x=new Rational(49,13)
val y=new Rational(47,128)

println (x + "+" + y +"=" + x.+(y) )
println (x + "*" + y +"=" + x*y )
}
}


Any idea's / hints ?

TIA
Joe Herrmann




--
(≥ⓛㅅⓛ≀)
Ne perdez pas courage!
Ce n`est pas encore fini.
Loading...