- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Struggling with Scala IDE in Eclipse
Mon, 2011-12-19, 20:47
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica; color: #000}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 17.0px; font: 14.0px Helvetica; color: #000; min-height: 17.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Monaco}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Monaco; min-height: 19.0px}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Monaco; color: #3e3e3e}
p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 17.0px; font: 14.0px Helvetica; min-height: 17.0px}
p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 17.0px; font: 14.0px Helvetica}
p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #646464}
p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #161616}
span.s1 {color: #3e3e3e}
span.s2 {color: #000}
span.s3 {color: #2f2f2f}
span.s4 {color: #646464}
span.s5 {text-decoration: underline}
span.s6 {text-decoration: underline ; color: #161616}
span.Apple-tab-span {white-space:pre}
Using a 2-week old version of Scala IDE in Eclipse, with this code:
import scala.collection.immutable.ListMap
case class Compound (name: String)
case class ChemicalReaction (reactants: ListMap[Compound,Int], products: ListMap[Compound,Int])
object Go {
def main (args: Array[String]) : Unit = {
println(Compound("H2O"))
}
}
I get this when I run:
Exception in thread "main" java.lang.NoClassDefFoundError: Go
Caused by: java.lang.ClassNotFoundException: Go
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Doing the same in the REPL works fine. Any idea what is going on?
Thanks.
Mon, 2011-12-19, 23:01
#2
Re: Struggling with Scala IDE in Eclipse
On 2011-12-19 13:57:25 -0600, Eduardo M. Cavalcanti said:
> Hi,
> Try placing the case classes after object Go definition.
No difference.
>
> On 19/12/2011 17:47, Sophie wrote:
> Using a 2-week old version of Scala IDE in Eclipse, with this code:
>
> import scala.collection.immutable.ListMap
>
> case class Compound (name: String)
>
> case class ChemicalReaction (reactants: ListMap[Compound,Int],
> products: ListMap[Compound,Int])
>
> object Go {
> def main (args: Array[String]) : Unit = {
> println(Compound("H2O"))
> }
> }
>
> I get this when I run:
> Exception in thread "main" java.lang.NoClassDefFoundError: Go
> Caused by: java.lang.ClassNotFoundException: Go
> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>
> Doing the same in the REPL works fine. Any idea what is going on?
>
> Thanks.
Mon, 2011-12-19, 23:11
#3
Re: Re: Struggling with Scala IDE in Eclipse
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
In my experience, the Scala IDE is much less tolerant of errors anywhere
in a project than the JDT. Are there any red Xs or squiggles anywhere?
Are there any problems listed in Eclipse's problems view? If either of
those is true, it's quite likely no class files will be generated,
leading to the error you saw.
On 12/19/2011 04:57 PM, Sophie wrote:
>> Hi,
>> > Try placing the case classes after object Go definition.
> No difference.
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk7vtfUACgkQ5IyIbnMUeTsbOACffNFt1Lc8qceornqgdXWlk8ZU
U10AmweoRE7PDSTd0RfiCSUmODpXg5pB
=xKWf
-----END PGP SIGNATURE-----
Tue, 2011-12-20, 00:31
#4
Re: Struggling with Scala IDE in Eclipse
Did you check for Scala IDE updates? I recently installed and had
similar issues, after updating it worked.
if that does not work you could try the 'Scala IDE User' group
Tue, 2011-12-20, 07:01
#5
Re: Struggling with Scala IDE in Eclipse
Thanks, all. Tried updating IDE, got into some inconsistent state with
updates. Aargh!
:-)
On 2011-12-19 17:24:44 -0600, tom pacheco said:
> Did you check for Scala IDE updates? I recently installed and had
> similar issues, after updating it worked.
>
> if that does not work you could try the 'Scala IDE User' group
Tue, 2011-12-20, 07:21
#6
Re: Struggling with Scala IDE in Eclipse
p, li { white-space: pre-wrap; }
Am Montag, 19. Dezember 2011, 20:47:10 schrieb Sophie:
> Using a 2-week old version of Scala IDE in Eclipse, with this code:
>
> import scala.collection.immutable.ListMap
>
> case class Compound (name: String)
>
> case class ChemicalReaction (reactants: ListMap[Compound,Int],
> products: ListMap[Compound,Int])
>
> object Go {
> def main (args: Array[String]) : Unit = {
> println(Compound("H2O"))
> }
> }
>
> I get this when I run:
> Exception in thread "main" java.lang.NoClassDefFoundError: Go
> Caused by: java.lang.ClassNotFoundException: Go
> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>
> Doing the same in the REPL works fine. Any idea what is going on?
>
> Thanks.
Hi Sophie,
if there is an error anywhere in your eclipse project (even in unreleated packages - e.g. in test packages within your project) eclipse sometimes does not emit the binaries to run. I checked your example by copy & paste and it runs fine.
So go into the "Problems" view of your project (make sure you have the filter set to display all problems within the project, not only the local ones) and check if there is anything listed. Take care of that until all problems are resolved. Then it should work.
Greetings
Bernd
Try placing the case classes after object Go definition.
On 19/12/2011 17:47, Sophie wrote: