I'm trying to compile a Scala class file that extends a Java class. Here is the class definition, it's as basic as it gets. On load, in the host application, the object should write "Hello from Scala" to the host's output window, using the superclass's method 'post'.
import com.cycling74.max.MaxObject;
public class FirstClass extends MaxObject{
public FirstClass{
post("Hello From Java");
}
}
This compiles and runs fine in the application.
Here is my translation to Scala (to be honest I'm not 100% sure I completely understand constructors in Scala):
import com.cycling74.max._
class FirstClass() extends MaxObject {
super.post("Hello from Scala")
}
But, when I try to compile with scalac, I receive the following error:
dm$ scalac -cp max.jar FirstClass.scala
FirstClass.scala:3: error: value post is not a member of com.cycling74.max.MaxObject with ScalaObject
super.post("Hello from Scala")
^
one error found
I'm not sure why the compiler is telling me that 'post' is not a member function, I'm certain that I've botched the Scala syntax, but cannot determine what is wrong.
Thanks!
EDIT
here's the output from the Max window, in addition to changing the code as prescribed below, i just added the Scala libs to Max's dynamic loadpath. This is exciting
MXJ System CLASSPATH:
/Applications/Max 6.1/Cycling '74/java/lib/jitter.jar
/Applications/Max 6.1/Cycling '74/java/lib/jode-1.1.2-pre-embedded.jar
/Applications/Max 6.1/Cycling '74/java/lib/max.jar
MXJClassloader CLASSPATH:
/Applications/Max 6.1/Cycling '74/java/classes/
/Users/dm/maxmsp/classes
/Users/dm/maxmsp/jars/jline.jar
/Users/dm/maxmsp/jars/scala-compiler.jar
/Users/dm/maxmsp/jars/scala-dbc.jar
/Users/dm/maxmsp/jars/scala-library.jar
/Users/dm/maxmsp/jars/scala-partest.jar
/Users/dm/maxmsp/jars/scala-swing.jar
/Users/dm/maxmsp/jars/scalacheck.jar
/Users/dm/maxmsp/jars/scalap.jar
Jitter initialized
Jitter Java support installed
Hello from Scala