wood burning stoves 2.0*
The moose likes Java in General and the fly likes getResourceAsStream i get null. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "getResourceAsStream i get null." Watch "getResourceAsStream i get null." New topic
Author

getResourceAsStream i get null.

Frank Jacobsen
Ranch Hand

Joined: May 17, 2002
Posts: 353
I have a resource that i want to read in my main program, but i get null.

I have tryed to put the xlsx "xl 2007" in the same directory as my java main program, but still i get null.

Any god ideas out there ?



I running on a ubunto mashine.


Frank
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

With the first line you should put the .xlsx file in the same folder as the PIOExample.class file. If that's inside a JAR file then the .xlsx file should go in that JAR file as well.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Martin Vanyavchich
Ranch Hand

Joined: Sep 16, 2008
Posts: 241
I think getResourceAsStream() method should be used when reading from .jar files. Try using plain java.io.File, FileReader and stream objects.


SCJP 6, OCMJD 6, OCPJWSD 6
I no good English.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getResourceAsStream i get null.