My Problem:
error: object swing is not a member of package scala
import scala.swing._
^
When I try to start any GUI App with Scala. What I tryed up to now: call directly by the scala command, and precompile first by scalac and fsc, nothing works.
My System: an Ubuntu 11.10 Machine, with installed OpenJDK 6, OpenJDK 7, Oracle JDK 6 and the Scala-Packe from the Ubuntu Repositories, additionally I tryed the "new" Scala from the official Scala Homepage (scala-lang). The .deb-package fails to install, but the plain files from the *.tgz file works so far.
I tried every possible combination of those Software I have installed, no one works.
The Joke: on my Windows 7 Machine, the same code (dropbox-sync) works without any problems.
Any Ideas? Did I forget something?
already many months since the original question, but since I just ran into the same, and googling showed this thread:
Looks like they separated scala swing from the core swing library. So if you're using sbt: libraryDependencies += "org.scala-lang" % "scala-swing" % "2.10.2"
(I guess the previous answers imply that as well, really, but since I got that error and this was the fix, I'm just adding it for others' reference).
It is apparently not finding scala-swing.jar
on the classpath. I'm not sure why this would be; it works on my system (still 11.04; don't like Unity). Try adding it explicitly: -cp /wherever/oneiric-ocelot/puts/scala/lib/scala-swing.jar
.
If the file is not on your system, you can download it from the project webpage. (Click on the appropriate "latest release" buttons in the README, just under the title. Then download the jar.)
the easiest way to resolve this error is to either download the scala.swing package and keep it in a folder called lib in your main project folder. this way when you compile the program uing sbt or any other tool the compiler will scan the lib folder and update itself with the new package. the other way is to edit the build.sbt file by adding the following line in it
"org.scala-lang" % "scala-swing" % "2.10.2"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With