This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Eclipse plugin too buggy for my Hello World - Am I doing anything wrong?

7 replies
Morten
Joined: 2009-07-12,
User offline. Last seen 42 years 45 weeks ago.
I am new to Scala but decided to give it a try today and installed the newest 2.7.5final Eclipse Plugin for Eclipse 3.4 on my Mac OS X 10.5. Just in the first 2 minutes of testing I ran into two bugs - one of them fatal - which leads me to ask if this plugin is indeed ready for serious use or if I am doing anything wrong ?

THE BUGS:
After install+restart I created a new java projected, added scala nature and added a package "testpackage" with a new scala file ScalaTest.scala:

package testpackage
object ScalaTest {
    def main(args: Array[String]) {
      println("Hello, world!")
    }
}

When I right click on the file and select "Run as scala application" I get this exception:
Exception in thread "main" java.lang.NoClassDefFoundError: testpackage/ScalaTes
Caused by: java.lang.ClassNotFoundException: testpackage.ScalaTes
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:254)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:402)

Note that the class the plugin tries to run lacks a "t" at the end, so it seems to be a bug in the plugin (properly some sub-string operation going wrong). Apart from this fatal bug, I also notice that plugin copies *.scala files to the build directory which consequently contains a mix of source code and *.class files. Hence any generated jar files will incorrectly contain source files as well.

So in conclusion, I have manged to run into one fatal bug and one minor bug in just 2 minutes for my first try of the plugin. How are the experience from other developers on this list ?

P.S. No I did not report this as bug request. Generally, to do that I need to be convinced that the software is usable and maintained. I am willing to give the eclipse plugin the benefit of the doubt though which is why have written the msg.



Få en billig laptop. Se Kelkoos gode tilbud her!
Ricky Clarkson
Joined: 2008-12-19,
User offline. Last seen 3 years 2 weeks ago.
Re: Eclipse plugin too buggy for my Hello World - Am I doing a

No, it's not ready for serious use. Miles apparently is getting quite
close to getting it there. It is maintained, no worries on that
score. Watch this list for an update on usability.

The IDEA plugin seems more complete.

2009/7/12 Morten :
> I am new to Scala but decided to give it a try today and installed the
> newest 2.7.5final Eclipse Plugin for Eclipse 3.4 on my Mac OS X 10.5. Just
> in the first 2 minutes of testing I ran into two bugs - one of them fatal -
> which leads me to ask if this plugin is indeed ready for serious use or if I
> am doing anything wrong ?
>
> THE BUGS:
> After install+restart I created a new java projected, added scala nature and
> added a package "testpackage" with a new scala file ScalaTest.scala:
>
> package testpackage
> object ScalaTest {
>     def main(args: Array[String]) {
>       println("Hello, world!")
>     }
> }
>
> When I right click on the file and select "Run as scala application" I get
> this exception:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> testpackage/ScalaTes
> Caused by: java.lang.ClassNotFoundException: testpackage.ScalaTes
>     at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
>     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:254)
>     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:402)
>
> Note that the class the plugin tries to run lacks a "t" at the end, so it
> seems to be a bug in the plugin (properly some sub-string operation going
> wrong). Apart from this fatal bug, I also notice that plugin copies *.scala
> files to the build directory which consequently contains a mix of source
> code and *.class files. Hence any generated jar files will incorrectly
> contain source files as well.
>
> So in conclusion, I have manged to run into one fatal bug and one minor bug
> in just 2 minutes for my first try of the plugin. How are the experience
> from other developers on this list ?
>
> P.S. No I did not report this as bug request. Generally, to do that I need
> to be convinced that the software is usable and maintained. I am willing to
> give the eclipse plugin the benefit of the doubt though which is why have
> written the msg.
>
>
> ________________________________
> Få en billig laptop. Se Kelkoos gode tilbud her!

milessabin
Joined: 2008-08-11,
User offline. Last seen 33 weeks 3 days ago.
Re: Eclipse plugin too buggy for my Hello World - Am I doing a

On Sun, Jul 12, 2009 at 8:04 PM, Morten wrote:
> Apart from this fatal bug, I also notice that plugin copies *.scala
> files to the build directory which consequently contains a mix of source
> code and *.class files. Hence any generated jar files will incorrectly
> contain source files as well.

This is a sure indication that whatever the appearances JDT Weaving is
not installed and/or enabled correctly.

You mentioned you were using Eclipse 3.4 ... the currently supported
versions are 3.4.2 and 3.5. Please upgrade and try again and get back
to me if you're still having problems.

Cheers,

Miles

Morten
Joined: 2009-07-12,
User offline. Last seen 42 years 45 weeks ago.
Re: Eclipse plugin too buggy for my Hello World - Am I doing a
As noted, both problems also occur with a freshly installed Eclipse 3.5 (on Windows) !

And, yes for my older elipse 3.4 I did check and JDT weaving as enabled already.

I am curious ? Can you reproduce ?

To Reproduce: create JAVA project "scalatest" + add scala nature + add package "testpackage" + add ScalaTest.scala as detailed ?

--- Den søn 12/7/09 skrev Miles Sabin <miles@milessabin.com>:

Fra: Miles Sabin <miles@milessabin.com>
Emne: Re: [scala-tools] Eclipse plugin too buggy for my Hello World - Am I doing anything wrong?
Til: "Morten" <mortench2004@yahoo.dk>
Cc: scala-tools@listes.epfl.ch
Dato: søndag 12. juli 2009 23.21

On Sun, Jul 12, 2009 at 8:04 PM, Morten<mortench2004 [at] yahoo [dot] dk" href="/mc/compose?to=mortench2004@yahoo.dk" rel="nofollow">mortench2004@yahoo.dk> wrote:
> Apart from this fatal bug, I also notice that plugin copies *.scala
> files to the build directory which consequently contains a mix of source
> code and *.class files. Hence any generated jar files will incorrectly
> contain source files as well.

This is a sure indication that whatever the appearances JDT Weaving is
not installed and/or enabled correctly.

You mentioned you were using Eclipse 3.4 ... the currently supported
versions are 3.4.2 and 3.5. Please upgrade and try again and get back
to me if you're still having problems.

Cheers,


Miles

--
Miles Sabin
tel: +44 (0)7813 944 528
skype:  milessabin
http://www.chuusai.com/
http://twitter.com/milessabin


Trænger du til at se det store billede? Kelkoo giver dig gode tilbud på LCD TV!
milessabin
Joined: 2008-08-11,
User offline. Last seen 33 weeks 3 days ago.
Re: Eclipse plugin too buggy for my Hello World - Am I doing a

On Sun, Jul 12, 2009 at 10:28 PM, Morten wrote:
> I am curious ? Can you reproduce ?
>
> To Reproduce: create JAVA project "scalatest" + add scala nature + add
> package "testpackage" + add ScalaTest.scala as detailed ?

No I can't.

I'm also curious ... do you get this problem if you start by creating
a Scala project rather than a Java one?

Cheers,

Miles

Morten
Joined: 2009-07-12,
User offline. Last seen 42 years 45 weeks ago.
Re: Eclipse plugin too buggy for my Hello World - Am I doing a
Great question Miles, because I just tried and yes creating a scala project instead of a java project (+ add scala nature) means the two problems disappear !! :-)

So I guess, the main problem must be in the "add scala nature" ! Unfortunately, since I am mostly interested in using scala for existing java projects this is a big thing for me.

However dispite using a scala project, I still get an new error msg "NoSuchMethodError : main" when I run the file (which might be because my hello world is wrong - after all it is my first scala program). Also, the error log in eclipse 3.5 shows various exceptions that may / may not be important ? Do you get any of those ?

--- Den søn 12/7/09 skrev Miles Sabin <miles@milessabin.com>:

Fra: Miles Sabin <miles@milessabin.com>
Emne: Re: [scala-tools] Eclipse plugin too buggy for my Hello World - Am I doing anything wrong?
Til: "Morten" <mortench2004@yahoo.dk>
Cc: scala-tools@listes.epfl.ch
Dato: søndag 12. juli 2009 23.35

On Sun, Jul 12, 2009 at 10:28 PM, Morten<mortench2004 [at] yahoo [dot] dk" href="/mc/compose?to=mortench2004@yahoo.dk" rel="nofollow">mortench2004@yahoo.dk> wrote:
> I am curious ? Can you reproduce ?
>
> To Reproduce: create JAVA project "scalatest" + add scala nature + add
> package "testpackage" + add ScalaTest.scala as detailed ?

No I can't.

I'm also curious ... do you get this problem if you start by creating
a Scala project rather than a Java one?

Cheers,


Miles

--
Miles Sabin
tel: +44 (0)7813 944 528
skype:  milessabin
http://www.chuusai.com/
http://twitter.com/milessabin


Få en billig laptop. Se Kelkoos gode tilbud her!
Morten
Joined: 2009-07-12,
User offline. Last seen 42 years 45 weeks ago.
Re: Eclipse plugin too buggy for my Hello World - Am I doing a
Actually, I got it to finally run now by also doing a "Clean"...

I guess the problem is that I intially created a scala class using the wizard instead of a scala object and changing the keyword from "class" to "object" in the IDE does not always force a overwite the old files.... So this is another bug I guess ?

I also suspect that the run problem with the missing last letter in the default configuration may only happen if one initially create a class instead of an object using the wizard ?

Sorry, if this description is a big unclear but being new to scala and the plugin it is difficult to accurately diagnose the exact circumstances where the bugs occur.

--- Den søn 12/7/09 skrev Morten <mortench2004@yahoo.dk>:

Fra: Morten <mortench2004@yahoo.dk>
Emne: Re: [scala-tools] Eclipse plugin too buggy for my Hello World - Am I doing anything wrong?
Til: "Miles Sabin" <miles@milessabin.com>
Cc: scala-tools@listes.epfl.ch
Dato: søndag 12. juli 2009 23.45

Great question Miles, because I just tried and yes creating a scala project instead of a java project (+ add scala nature) means the two problems disappear !! :-)

So I guess, the main problem must be in the "add scala nature" ! Unfortunately, since I am mostly interested in using scala for existing java projects this is a big thing for me.

However dispite using a scala project, I still get an new error msg "NoSuchMethodError : main" when I run the file (which might be because my hello world is wrong - after all it is my first scala program). Also, the error log in eclipse 3.5 shows various exceptions that may / may not be important ? Do you get any of those ?

--- Den søn 12/7/09 skrev Miles Sabin <miles@milessabin.com>:

Fra: Miles Sabin <miles@milessabin.com>
Emne: Re: [scala-tools] Eclipse plugin too buggy for my Hello World - Am I doing anything wrong?
Til: "Morten" <mortench2004@yahoo.dk>
Cc: scala-tools@listes.epfl.ch
Dato: søndag 12. juli 2009 23.35

On Sun, Jul 12, 2009 at 10:28 PM, Morten<mortench2004@yahoo.dk> wrote:
> I am curious ? Can you reproduce ?
>
> To Reproduce: create JAVA project "scalatest" + add scala nature + add
> package "testpackage" + add ScalaTest.scala as detailed ?

No I can't.

I'm also curious ... do you get this problem if you start by creating
a Scala project rather than a Java one?

Cheers,


Miles

--
Miles Sabin
tel: +44 (0)7813 944 528
skype:  milessabin
http://www.chuusai.com/
http://twitter.com/milessabin


Få en billig laptop. Se Kelkoos gode tilbud her!


Skal du købe ny bil? Sammenlign priser på brugte biler med Kelkoo og find et godt tilbud!
Ricky Clarkson
Joined: 2008-12-19,
User offline. Last seen 3 years 2 weeks ago.
Re: Eclipse plugin too buggy for my Hello World - Am I doing a

This would happen outside Eclipse. class X { } generates X.class, and
object X { } generates X$.class - so no overwriting occurs if you
change an object to a class or vice-versa. I can't speak for what the
IDE does or should do there, just giving a bit of background.

2009/7/12 Morten :
> Actually, I got it to finally run now by also doing a "Clean"...
>
> I guess the problem is that I intially created a scala class using the
> wizard instead of a scala object and changing the keyword from "class" to
> "object" in the IDE does not always force a overwite the old files.... So
> this is another bug I guess ?
>
> I also suspect that the run problem with the missing last letter in the
> default configuration may only happen if one initially create a class
> instead of an object using the wizard ?
>
> Sorry, if this description is a big unclear but being new to scala and the
> plugin it is difficult to accurately diagnose the exact circumstances where
> the bugs occur.
>

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland