The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

m.dr (70) [Avatar] Offline
#1
Hello All -

I am trying to go through the chapters and had a few questions while using the command line. I am using it in a slightly different way than most of you are I think.

I am writing the code within Eclipse (Juno) and fix any errors there. I am compiling with Gradle.

But since Gradle does not have a REPL (that works) and also I am using the Scala 2.10 plugin, there seems to be no REPL in Eclipse either to try out code.

So I am left with running from the command line (Scala installed in Ubuntu).

When I am at the Scala prompt in the directory src/main/scala below which the classes / objects exist in com.scalainaction., my imports to get to a class from the command line does not work.

So I am in src/main/scala and from the cmd line I run scala. I import com.scalainaction. This should import all classes under it. However when I say execute:
val client = new MongoClientV2("127.0.0.1", 123)

I get an error saying MongoClientV2 cannot be found. I even tried going to directory where MongoClientV2 is located and imported it it still does not find it.

I have included example snipped below:
...
scala> import com.scalainaction
import com.scalainaction

scala> val client = new MongoClientV2("127.0.0.1", 123)
<console>:8: error: not found: type MongoClientV2
val client = new MongoClientV2("127.0.0.1", 123)
...
As you can see the import statement works.
Fails on MongoClientV2. Its there in com.scalainaction.

Any ideas why this is happening - and what I may need to be doing to run from the command line - which would be my Scala REPL.

Thanks for your help.