spark-submit 文件未找到错误?

scala代码是:

val sourcePath = this.getClass.getResource("/stopwords.dic").getPath
    val stopwordsFile = Source.fromFile(sourcePath,"UTF-8")

打包以后的jar中有stopwords.dic这个文件

路径也是对的

但是还是报错了:
Caused by: java.io.FileNotFoundException: file:/Users/laiyinan/Desktop/cc_core/out/artifacts/cc/cc_core.jar!/stopwords.dic (No such file or directory)

求解!谢谢!

阅读 1.8k
1 个回答

image.png

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题