Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Query regarding using getClass().getResourceAsStream

807589Sep 17 2008 — edited Sep 17 2008
I would like to pass a file called 'abc_137.xml' stored on my c:\tradeSet
using the below
InputStream stream = this.getClass().getResourceAsStream("c:\tradeSet\abc_137.xml");

Error :

I get the MalFormedURLException
How can I pass the c:\tradeSet\<File> to getResourceAsStream?

getResourceAsStream() expects a String.

Can I use the File Object,convert this File Object to a String and pass it?

Please help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 15 2008
Added on Sep 17 2008
5 comments
159 views