I have a java maven project , i installed scala plugin for eclipse and added scala nature to my project . Now , i have written some custom scala Actors and some other utility classes .I am using these scala classes in my java code . while writing the code , it doesn't throw any errors .But , when i do maven clean /build , it throws compilation error's like below
11/8/11 10:45:23 AM : [ERROR] ............\Simple.java:[86,10] cannot find symbol
symbol : variable ExecutorObject
location: class com.ms.scala.Simple
11/8/11 10:45:23 AM : [INFO] 2 errors
11/8/11 10:45:23 AM : [INFO] -------------------------------------------------------------
11/8/11 10:45:23 AM : Build errors for Project; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project : Compilation failure
Eclipse IDE : helios -3.5 , Scala - 2.9.2 which comes with the plugin
i guess there is a custom compiler configuration for doing this ? i also have an other newbie question
how do you start scala actor directly in java and send a message to it ? all i can see is the act() method . i want to do this
actor {
CustomActor ! Message
}
in java
thank you
sanre6
解决方案
For the first part, have you added the scala compilation step to your maven pom? Have you added the maven-scala-plugin to your pom?
For the second part, as Mirco says, there is no simple way to define an Actor in Java. You'll have to define it in Scala, but you can then start it and send messages to it in Java.
Simply call start() on the instance, and then you should be able to pass messages to it using the ! method. This will be available in java, but it is called $bang.