简体   繁体   中英

Build error using Scala play-json JsValue.as to parse string

I'm using scala play-json to parse the keys from a simple json object from a string along the lines of

'{"test": "value", "hello": "world"}'

The code where I'm doing this looks like this:

val columns = Json.parse(value).as[JsObject].keys.toList

I was able to run this and get the result I wanted running the debugger in IntelliJ, so I know this code works fine. However, when I try to run sbt assembly on my project, I get a build error saying

Validation.scala:126: bad symbolic reference to java.time encountered in class file 'DefaultReads.class'.

[error] Cannot access term time in package java. The current classpath may be missing a definition for java.time, or DefaultReads.class may have been compiled against a version that's incompatible with the one found on the current classpath.

[error] val values = Json.parse(value).as[JsObject].keys.toList

I'm running jdk 1.8.0_111 so I shouldn't be having the issue I've found on other SO posts trying to use the play-json library.

I'm using sbt version 0.13.13, scala version 2.11.0, and (trying to use) play-json version 2.5.12

The issue was I had set the global jdk intellij and the jdk for the project, but I had recently changed my JAVA_HOME to jdk 1.7 and never changed it back.

Thanks for the responses anyways!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM