我创建了一个没有原型的简单Maven项目,一切都很好.然后我CVA.pmml在main/resources目录下添加了一个文件.之后,我想读取文件但得到FileNotFoundException.我尝试了以下方法:
方法1:
InputStream is = BundleTest.class.getResourceAsStream("CVA.pmml");
Run Code Online (Sandbox Code Playgroud)
方法2:
InputStream is = BundleTest.class.getResourceAsStream("resources/CVA.pmml");
Run Code Online (Sandbox Code Playgroud)
方法3:
InputStream is = new FileInputStream("CVA.pmml");
Run Code Online (Sandbox Code Playgroud)
方法4:
InputStream is = new FileInputStream("resources/CVA.pmml");
Run Code Online (Sandbox Code Playgroud)
它们都不起作用.有什么建议吗?
以下是项目结构的屏幕截图:
