Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Scala as if it was Java

Tags:

eclipse

scala

I've been reading up on Scala a lot recently and I really want to get into it. I do my Java web development from within Eclipse with Tomcat as my preferred server and I'd like to keep it that way. I've tried the Scala Eclipse plugin but it's safe to say, it isn't there yet. I had to uninstall it because it simply ins't working. On top of that, it doesn't seem to provide anything for doing web projects (I could be wrong there).

Since Scala is a compiled language just like Java is, I was wondering if it's possible to simply swap out Java with Scala, as in, where I'd normally would create Java classes I would now be able to create Scala classes instead? Maybe even mix Java and Scala?

Is there anyone out there who's been able to set up a decent Scala workflow in Eclipse for web development without the dreaded "official" Scala Eclipse Plugin?

PS: I've tried the Play framework (I think it recently added Scala support) but it simply isn't for me. I like my classes compiled and to use JSP's for my views.

like image 561
Luke Avatar asked Jul 03 '26 07:07

Luke


2 Answers

You don't say anything about what version of the Scala IDE for Eclipse you were using, or what you tried to do to resolve your issues. I suggest that before changing your workflow you head over to http://groups.google.com/group/scala-ide-user and see if we can help you out.

like image 100
Miles Sabin Avatar answered Jul 06 '26 09:07

Miles Sabin


Since Scala is a compiled language just like Java is, I was wondering if it's possible to simply swap out Java with Scala, as in, where I'd normally would create Java classes I would now be able to create Scala classes instead?

Yes, absolutely. That's one of Scala's big advantages over some other JVM languages.

Maybe even mix Java and Scala?

Yes, absolutely. That's one of Scala's big advantages over some other JVM languages.

Make sure you have familiarity with the Java and Scala collections libraries (and that you keep them straight -- if you're planning using advanced Scala features on Java collections, definitely use a Scala 2.8 release candidate). Also make sure you're faimilar with the @BeanProperty annotation -- it can simplify your Scala coding somewhat.

like image 44
Ken Bloom Avatar answered Jul 06 '26 11:07

Ken Bloom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!