-
Notifications
You must be signed in to change notification settings - Fork 844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
运行jar包时提示:java.io.FileNotFoundException: nullsampledata/movies.csv #23
Comments
|
通过修改:SparrowRecSys-master/src/main/java/com/sparrowrecsys/online/RecSysServer.java文件里面: |
问题在于本身这个URI指向的是这个jar包,他是个文件,然后底下的load方法尝试使用Scanner去读取文件(jar包)中的文件,这是有问题的,需要改成使用Stream的方式去读取 loadMovieData等方法中修改Scanner读取的方式 然后启动类中修改为相对路径即可 |
如果了解一点Spring Boot 不妨看看Java的实现:https://github.com/iqiancheng/sparrow-recsys-spring-boot |
$ java -jar SparrowRecSys-1.0-SNAPSHOT-jar-with-dependencies.jar
log4j:WARN No appenders could be found for logger (org.eclipse.jetty.util.log).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
webRootLocation.toURI().toASCIIString(): jar:file:/mnt/e/work/SparrowRecSys/target/SparrowRecSys-1.0-SNAPSHOT-jar-with-dependencies.jar!/webroot/index.html
Web Root URI: null
Loading movie data from nullsampledata/movies.csv ...
Exception in thread "main" java.io.FileNotFoundException: nullsampledata/movies.csv (No such file or directory)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.(FileInputStream.java:157)
at java.base/java.util.Scanner.(Scanner.java:639)
at com.sparrowrecsys.online.datamanager.DataManager.loadMovieData(DataManager.java:56)
at com.sparrowrecsys.online.datamanager.DataManager.loadData(DataManager.java:41)
at com.sparrowrecsys.online.RecSysServer.run(RecSysServer.java:54)
at com.sparrowrecsys.online.RecSysServer.main(RecSysServer.java:21)
The text was updated successfully, but these errors were encountered: