问题复现:
Spark-Second_Edition/第6章/src/main/scala$ scalac -cp self_jars/*.jar AssembleDocumentTermMatrix.scala RunLSA.scala
error: IO error while decoding self_jars/stanford-corenlp-3.4.1.jar with UTF-8
Please try specifying another one using the -encoding option
one error found
因为很多个.jar包导入的时候,中间是用空格隔开的,而不是用冒号隔开的,所以被scalac误以为编码有问题,
其实不是编码问题,而是格式问题,好了,解决方案是:
scalac -classpath $(echo *.jar dependencies/*.jar | tr ' ' ':') PageRank.scala
scala -classpath $(echo *.jar dependencies/*.jar | tr ' ' ':') PageRank
上面的tr命令类似于sed,意思是把空格替换为冒号
亲测有效
转载自: