lundi, mars 07, 2011

Scala and Java libraries in Eclipse

Don't try to mix scala and java in the same scala project in eclipse. You will 1st have the feeling that it works, but as they are not compiled the same way, it's better to have java and scala files in separate projects. Scala project should have the java project as a dependency.

To get it working, you have to do a lot of project cleaning, to "synchronize" both projects.

A Scala file using a Java class:
   import kbdmatrix_java._
   class KbdMatrix(val L: MyLog) {

The Java file:
   package kbdmatrix_java;
   public class MyLog {

Do not forget to advertize the Java class and its methods as public.

Aucun commentaire: