D
Digby
Hi all,
I've just written some code (see below) which relies on the
getResourceAsStream of the ClassLoader object to get a file as an
InputStream. Strangely, though it works when I run it locally, when I stick
the code and the file on a Web server, I get null returned instead. I guess
it's a classpath issue, but I thought that this method was supposed to get
round that.
Classes:
package a.b.c;
public class D {
public InputSteam getfileAsStream() {
return ClassLoader.getResourceAsStream("filename.txt");
}
}
package a.b;
public class E {
public static void main(String[] args) {
D d = new D();
System.out.println(d.getFileAsStream());
}
}
File structure:
a/b/c/D
a/b/c/filename.txt
a/b/E
I am executing E.
Any ideas? The Web server is WebSphere 3.5.
TIA
Dig
I've just written some code (see below) which relies on the
getResourceAsStream of the ClassLoader object to get a file as an
InputStream. Strangely, though it works when I run it locally, when I stick
the code and the file on a Web server, I get null returned instead. I guess
it's a classpath issue, but I thought that this method was supposed to get
round that.
Classes:
package a.b.c;
public class D {
public InputSteam getfileAsStream() {
return ClassLoader.getResourceAsStream("filename.txt");
}
}
package a.b;
public class E {
public static void main(String[] args) {
D d = new D();
System.out.println(d.getFileAsStream());
}
}
File structure:
a/b/c/D
a/b/c/filename.txt
a/b/E
I am executing E.
Any ideas? The Web server is WebSphere 3.5.
TIA
Dig