Reputation: 31176
I'm using:
% scalac -version
Scala compiler version 2.9.1 -- Copyright 2002-2011, LAMP/EPFL
on Ubuntu 12.04.
This code is saved in HelloGui.scala:
import scala.swing._
object HelloGui extends SimpleSwingApplication {
def top = new MainFrame {
title = "Hello World GUI"
contents = new Button {
text = "Click me"
}
}
}
When I try to compile this I get:
% scalac HelloGui.scala
HelloGui.scala:1: error: object swing is not a member of package scala
import scala.swing._
^
one error found
I've tried using import swing._
(it isn't clear from the tutorials which import path I need to use with this version of scala), and I get:
% scalac HelloGui.scala
HelloGui.scala:1: error: not found: object swing
import swing._
^
one error found
When I look in /usr/share/java, I see scala-swing-2.9.1.jar and scala-swing.jar as a symlink to it, so it seems like the libraries are present?
Am I missing a compiler flag or is there another package I need to install?
Upvotes: 0
Views: 1666
Reputation: 31176
The compiler needs to have the path to the swing jar passed explicitly. This works:
% scalac -classpath /usr/share/java/scala-swing.jar HelloGui.scala
Upvotes: 2