Scala Nature in Eclipse

February 19, 2009

Since I’ve been trying to have Scala help with simplifying Java code, I’ve been looking into the possibility of having java and scala classes in the same project(under netbeans and Eclipse). While Netbeans doesnt seem to have this functionality available yet,  someone pointed out the “scala nature” functionality in Eclipse.

Basically, if you have a Java project, you can do a right click -> Scala -> Add Scala Nature. Doing so puts the scala libraries on the classpath and converts the project to a Scala project. This is supposed to allow one to have both Java and scala code in the same project and have them refer to each other.
I’ve been trying this. Here’s what I have:
1.  Scala objects are not visible from java classes, only scala classes are, this is apparently a known problem. I dont see why it would a problem allowing the access of the object’s methods like one would access static methods in Java.
2. When I right click -> Scala -> add Scala Nature for a JavaEE project, it does not add the scala libraries to the project classpath. So this does not solve my problem of having Scala code in Java Web apps.
3. So adding Scala nature only works for regular Java Projects for now.

Its a start though, and if we can access Scala objects and have JavaEE web apps which scala code in them, it’ll bring us one step closer to JavaEE nirvana :-) .

5 Responses to “Scala Nature in Eclipse”

  1. Hi,

    Regarding point 1, this seems to be solved in the latest recent nightlies. See http://lampsvn.epfl.ch/trac/scala/ticket/1238#comment:6 .

    You should file a bug for point 2 although the workaround should be relatively simple.

    Ismael

  2. vikasvrao said

    Thanks Ismael. I created a new ticket http://lampsvn.epfl.ch/trac/scala/ticket/1744, hopefully my description etc was proper.

  3. Thanks, that’s the first step towards getting it fixed. :)

  4. Mike said

    Just passing by.Btw, your website have great content!

    _________________________________
    Making Money $150 An Hour

  5. Jawher said

    Hi,
    I’ve recently experienced the same problem, whereas this used to work before (with the old plugin) :
    - http://blog.developpez.com/djo-mos/p5399/java/scala/ajouter-le-support-scala-a-un-projet-web/
    and :
    - http://blog.developpez.com/djo-mos/p5428/java/wicket/wicket-et-scala-voici-ce-que-ca-donne/

    (the two blog posts are in french, but the screenshots should be universally understood :D )

    I’m glad to see that I’m not alone in the world ;)

    Cheers

Leave a Reply