Login  Register

Re: FileNotFoundException

Posted by Davíð Þór Bragason on Aug 02, 2015; 10:02pm
URL: http://imagej.273.s1.nabble.com/FileNotFoundException-tp5013848p5013853.html

Hi Vladimir,

I believe in a case like this you need to access the file as as "resource",
something like:

BufferedReader br = new BufferedReader(new InputStreamReader(
getClass().getClassLoader().getResourceAsStream("weights.txt")));

Regards,
David


On Sun, Aug 2, 2015 at 12:06 PM, Vladimir Nizamutdinov <[hidden email]
> wrote:

> Hello all! My plugin reads data from a text file, and I want to put
> this file in jar archive together with binaries classes. I put this
> file in the root of the archive, and read as BufferedReader br = new
> BufferedReader(new FileReader("weights.txt"));
> but still I get FileNotFoundException. How can i fix this error?
> --
> Best regards,
> Nizamutdinov Vladimir
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html