How to read a file (e.g txt file) from another java package withouth specifying the absolute path? -
i have stored non-java files in package. want read files package without specifying absolute path file(e.g c:\etc\etc...). how should this?
for example:
myclass.class.getresourceasstream("file.txt");
will open file.txt
if it's in same package myclass
also:
myclass.class.getresourceasstream("/com/foo/bar/file.txt");
will open file.txt
on package com.foo.bar
good luck! :)
Comments
Post a Comment