Unable to import spray in scala.

Asked 2 years ago, Updated 2 years ago, 89 views

As the sample code used a library called spray, I tried using the interpreter and got the following error:

Scala itself has only just started recently, and I don't know how to deal with these cases.
I thought it might be necessary to install something like a gem in ruby, but
I was looking into how to do it, but I didn't know...

scala>import spray.json.JsValue
:7:error:not found:value spray
       import spray.json.JsValue

Could someone please tell me?

Or is it impossible to import an interpreter in the first place?

Thank you for your cooperation.

Additional information

~ ~scala-cp spray-json_2.11-1.3.2.jar
Welcome to Scala version 2.10.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_66).
Type in expressions to have them validated.
Type—help for more information.

scala>import spray.json.JsValue
:7:error:not found:value spray
       import spray.json.JsValue
              ^
scala>spray.json.JsValue
:8:error:not found:value spray
              spray.json.JsValue
              ^

scala>spray
:8:error:not found:value spray
              spray
              ^

scala

2022-09-30 19:31

1 Answers

How about this?

scala-cp spray-json_2.11-1.3.2.jar

The JAR is in a repository called maven.
http://mvnrepository.com/artifact/io.spray/spray-json_2.11

You can see that the import is done like this.

$scala-cp spray-json_2.11-1.3.2.jar
Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_31).
Type in expressions to have them validated.
Type—help for more information.

scala>spray.json.JsFalse
res0:spray.json.JsFalse.type=false

scala>


2022-09-30 19:31

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.