Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » getResourceAsStream
getResourceAsStream [message #1229786] Fri, 10 January 2014 08:07 Go to next message
Jayaprakash K is currently offline Jayaprakash KFriend
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 11:46 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
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.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: getResourceAsStream [message #1231496 is a reply to message #1229786] Tue, 14 January 2014 20:33 Go to previous message
Dilton McGowan II is currently offline Dilton McGowan IIFriend
Messages: 110
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: Fri Apr 19 22:50:00 GMT 2024

Powered by FUDForum. Page generated in 0.07400 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top