getResourceAsStream() stops working when run online!
I have written an applet that I am hosting on a geocities website. The applet
runs fine in NetBeans, and locally fram an html file, but when I try to run the
applet online, the:
BufferedReader in=new BufferedReader(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream("One.txt")));
(it used to be "this.getClass().getResourceAsStream()", but after many
forum searches and revisions the above version still works in NetBeans
but not online)
line throws a NullPointerException because it cant find the file.
When I disable this line of code, the applet shows up just fine,
but has no functionality because it draws graphs of the information
found in the text file I am trying to read.
Everything is in the same directory, is this a problem with file permissions?
Or is it a problem with how getResourceAsStream() looks for files?
[1036 byte] By [
mtb70mpha] at [2007-11-27 10:44:24]

Thanks for the reply, but its still not working =/
I did what you said
URL urll = getClass().getResource("/One.txt");
Then did this to get the inputstream
BufferedReader in= new BufferedReader(new InputStreamReader(urll.openStream()));
Any ideas?
All of the files are in the same directory though, I have already tried putting them in a subdirectory and using the codebase="foldername" part in the applet tag, but the same error results. I was thinking that this could be due to security measures on geocities (my applet isnt signed), but wouldn't that throw a SecurityException rather than a NullPointerException?
Thanks for all of the responses by the way =)
I am not using a jar at the moment, I was messing with that earlier and
was more complicated than it needed to be, I have all of the class files
for my buttons and such as well as the main applet class "Grapher.class"
and the class that reads the text file "GetStuff.class" in the main directory of
my geocities page, "www.geocities.com/bbubenheim/" and the applet tag in
the html is:
<applet code="Graph.class" height="600" width="1000">
</applet>
since everything is in the main directory and not jarred then there should be
no need for an "archive" or "codebase" part.
Should I try hosting it somewhere else? Or am I missing something?
Oh ****, thats because I tried doing a JARConnection a few minutes ago
that involved reading 240 smaller portions of my .txt file, and I think the error
message results when geocities get freaked out by something trying to
access information 240 times in a second, I really dont like geocities i was just
using it because it is free, I'll try to host it somewhere else, thanks for the help,
is there anything I can try that is not host server-related?