Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » getResourceAsStream
getResourceAsStream [message #1229786] Fri, 10 January 2014 03:07 Go to next message
Jayaprakash K is currently offline Jayaprakash K
Messages: 1
Registered: January 2014
Junior Member
I am using eclipse-indigo.

I download a file from internet then use that in eclipse by copying that file to my working place then create a new java project with that same name. In that program there is a line to read a file by using

classname.class.getResourceAsStream("textfilename");

but it throws a NullPointerException.

Then, I create a new java project in eclipse and check that reading this file as a small program,that executes successfully. The files are within the same package in both cases.

Please guide me the above, and also I am looking for advice on how to link a file in eclipse indigo.
Thanks in advance.
Re: getResourceAsStream [message #1230237 is a reply to message #1229786] Sat, 11 January 2014 06:46 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26014
Registered: July 2009
Senior Member
If the file copied to the bin folder? You can use the Navigator view to
inspect what's in the bin folder.

On 10/01/2014 3:41 PM, Jayaprakash K wrote:
> I am using eclipse-indigo.
>
> I download a file from internet then use that in eclipse by copying
> that file to my working place then create a new java project with that
> same name. In that program there is a line to read a file by using
>
> classname.class.getResourceAsStream("textfilename");
>
> but it throws a NullPointerException.
>
> Then, I create a new java project in eclipse and check that reading
> this file as a small program,that executes successfully. The files are
> within the same package in both cases.
>
> Please guide me the above, and also I am looking for advice on how to
> link a file in eclipse indigo.
> Thanks in advance.
Re: getResourceAsStream [message #1231496 is a reply to message #1229786] Tue, 14 January 2014 15:33 Go to previous message
Dilton McGowan II is currently offline Dilton McGowan II
Messages: 106
Registered: July 2009
Senior Member
On Fri, 10 Jan 2014 09:41:18 -0500, Jayaprakash K wrote:

> I am using eclipse-indigo.
>
> I download a file from internet then use that in eclipse by copying that file to my working place then create a new java project with that same name. In that program there is a line to read a file by using
>
> classname.class.getResourceAsStream("textfilename");
>
> but it throws a NullPointerException.
>
> Then, I create a new java project in eclipse and check that reading this file as a small program,that executes successfully. The files are within the same package in both cases.
>
> Please guide me the above, and also I am looking for advice on how to link a file in eclipse indigo.
> Thanks in advance.

Sometimes it's helpful to write a test file where
you are trying to read the original file from then
locate the test file on disk to see where it actually
got written to.
Previous Topic:sunJCE_provider problem
Next Topic:Setting a local osgi.configuration.area for a Windows multi-user install
Goto Forum:
  


Current Time: Sat Aug 30 14:43:31 EDT 2014

Powered by FUDForum. Page generated in 0.03598 seconds