You actually shouldn't have to change your code. The using of InputStream
was just a suggestion. It's always the best to use the highest level object
you can. It just helps you change from a FileInputStream to say a
StringBufferInputStream without changing other code.

If you can debug it, I would check to see what the name of the file is that
is returned and make sure it's in the JAR or at least your classpath. The
code looks fine, but my guess would be that it's not found in the classpath.
--
James R. Perkins


On Tue, May 5, 2009 at 08:42, Lim Hock-Chai
<Lim.Hock-Chai@xxxxxxxxxxxxxxx>wrote:

Thanks James, I was hoping that we do not have to change code for this.
My project is to move our J2EE application from jBOSS to WAS6.1.

Below are relevent code that does the setFile:

public static File findFile( String fileName ) {
File file = null;
URL url = FileUtil.class.getClassLoader().getResource( fileName
);
if( url != null ) {
String decodedUrl = null;
try {
decodedUrl = URLDecoder.decode( url.getPath(), "ASCII"
);
} catch( UnsupportedEncodingException uee ) {
uee.printStackTrace();
}
file = new File( decodedUrl );
}
return file;
}


I'll look to see what the different between FileInputStream in
InputStream.

Thanks

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.