[英]Sbt project loading error - “java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter”
In IntelliJ Idea on OS XI have a project (a Coursera assignment file, with no homework functions implemented yet) that is compiling in Idea, but when I try to load it in sbt in the terminal from the project root folder, using just "sbt", I get the error: 在OS XI上的IntelliJ Idea中,有一个正在Idea中编译的项目(Coursera分配文件,尚未实现任何功课功能),但是当我尝试从项目根目录的终端中的sbt中加载它时,仅使用“ sbt ”,我得到了错误:
[info] Loading project definition from <omitted>/calculator/project
java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
at sbt.inc.TextAnalysisFormat$ObjectStringifier$$anonfun$34.apply(TextAnalysisFormat.scala:336)
<trace omitted>
[error] (compile:readAnalysis) java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
build.sbt scalaVersion is 2.11.7; build.sbt scalaVersion为2.11.7; in the Idea project structure window Global Libraries tab, I have scala-sdk-2.12.4, and in the SDKs and Project tabs, I have Java 1.8.
在“想法”项目结构窗口的“全局库”选项卡中,我具有scala-sdk-2.12.4,在“开发工具包”和“项目”选项卡中,我具有Java 1.8。
Brew tells me I have sbt 1.0.4, but when I run sbt --about from the project folder, it shows me: Brew告诉我我拥有sbt 1.0.4,但是当我从项目文件夹运行sbt --about时,它显示了我:
[info] This is sbt 0.13.9
[info] No project is currently loaded
[info] sbt, sbt plugins, and build definitions are using Scala 2.10.5
followed by an attempt to load the project and the resulting error. 然后尝试加载项目并导致错误。 The build.properties file in the project has sbt version 0.13.9, but why does the sbt about info show Scala 2.10.5?
项目中的build.properties文件具有sbt版本0.13.9,但是关于信息的sbt为什么显示Scala 2.10.5?
I have both Java 8 and Java 9 installed on my system (via brew cask) - is it possible that sbt is for some reason using Java 9 instead of Java 8, and if so, how would I check and fix that? 我的系统上同时安装了Java 8和Java 9(通过brew cask)-sbt是否可能由于某种原因使用Java 9而不是Java 8,如果是这样,我将如何检查并修复它? The install command for Java 9 was "brew cask install java", while for Java 8 it was "brew cask install java8".
Java 9的安装命令是“ brew cask install java”,而Java 8的安装命令是“ brew cask install java8”。
Edit: "java -version" command shows: 编辑:“ java -version”命令显示:
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
Scala and Java 9 have some interaction problems. Scala和Java 9有一些交互问题。 I uninstalled Java 9, since I don't need it instead of Java 8 for anything right now, and afterward the project loaded without error.
我卸载了Java 9,因为现在不需要它代替Java 8,之后再加载项目,而不会出现错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.