如何调用包中qlready的输入文件
在我的 Hadoop MapReduce 应用程序中,我有一个输入文件。我希望当我执行应用程序的 jar 时,将自动调用输入文件。为此,我编写了一个类来指定输入、输出和文件本身,但是从我调用文件的地方,我想指定文件路径。为此,我使用了这段代码:
QueriesTest.class.getResourceAsStream("/src/main/resources/test")
but it is not working (cannot read the input file from the generated jar)
所以我使用了这个
URL url = this.getClass().getResource("/src/main/resources/test") here I am getting the problem of URL. So please help me out. I am using Hadoop 0.21.
In my Hadoop Map Reduce application I have one input file.I want that when I execute the jar of my application, then the input file will automatically be called.To do this I code one class to specify the input,output and file itself but from where I am calling the file, there I want to specify the file path. To do that I have used this code:
QueriesTest.class.getResourceAsStream("/src/main/resources/test")
but it is not working (cannot read the input file from the generated jar)
so I have used this one
URL url = this.getClass().getResource("/src/main/resources/test") here I am getting the problem of URL. So please help me out. I am using Hadoop 0.21.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定您想通过资源加载告诉我们什么,但添加输入文件的常用方法是:
然后确保您的文件驻留在 HDFS 中。
I'm not sure what you want to tell us with your resource loading, but the usual way to add an input file is this:
Make sure your file resides in HDFS then.