Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FileNotFoundException java/io/Reader.class

2 views
Skip to first unread message

Matthias Brenner

unread,
Oct 19, 2000, 3:00:00 AM10/19/00
to
Hello,

i was trying to write (one of my first) java programms. Exactly i
want to write an applet. I used this code i got from the net (part
of the program):

8<----------------------------------------------------------

public static void main(String[] args) throws Exception {
URL yahoo = new URL("http://www.yahoo.com/");
BufferedReader in = new BufferedReader(
new InputStreamReader(
yahoo.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}

8<----------------------------------------------------------

This worked fine. I tried to embed this into an applet code i also
got from the net (also only a part of the program):

8<----------------------------------------------------------

public void start(){
try{
URL yahoo = new URL("http://midi/cgi-bin/antwort.cgi");
BufferedReader in = new BufferedReader(new
InputStreamReader(yahoo.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
addItem(inputLine);
in.close();
}catch(Exception ex){
ex.printStackTrace();
}
}

8<----------------------------------------------------------

The first problem was, that i didn't know where to put the
"throws Exception" part, so i used the "try" version, you
can see above. But when i try to load the applet from a
browser or start the appletviewer-program i get an error:
"java.io.FileNotFoundException: /<path to my webdir>/java/io/Reader.class
at java.io.FileInputStream.<init>(FileInputStream.java)
at
sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:67)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:75)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:59)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:172)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:122)
at java.lang.ClassLoader.resolveClass(ClassLoader.java)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:128)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:101)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:386)
at sun.applet.AppletPanel.run(AppletPanel.java:204)
at java.lang.Thread.run(Thread.java)
File not found when looking for: java.io.Reader
VERIFIER ERROR NochnApplet.start()V:
Cannot find class java/io/Reader
java.lang.VerifyError: NochnApplet
at java.lang.ClassLoader.resolveClass(ClassLoader.java)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:128)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:101)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:386)
at sun.applet.AppletPanel.run(AppletPanel.java:204)
at java.lang.Thread.run(Thread.java)"

I don't know how i can solve this proplem.
I used a Netscape 2.x and 4.x on my Linux PC.
Can someone help me? Thank you very much.


Bye

Matthias

Roedy Green

unread,
Oct 19, 2000, 3:00:00 AM10/19/00
to
On Thu, 19 Oct 2000 18:02:51 +0200, Matthias Brenner <bre...@mbe.de>
wrote or quoted :

>i was trying to write (one of my first) java programms. Exactly i
>want to write an applet. I used this code i got from the net (part
>of the program):

Applets are not allowed to talk to servers except the one they were
loaded from. See "Applet" in the Java glossary for the long list of
restrictions on Applets.


The Java & Internet Glossary is at http://mindprod.com
--
Roedy Green, Canadian Mind Products
-30-

Matthias Brenner

unread,
Oct 20, 2000, 12:38:44 AM10/20/00
to
Hi!

Thanks for your answer. But i tried to connect to the server from
where i loaded the applet. Perhaps there is an error because there
are really some files missing? Or i must write the URL in a special
way? Do you have a tip?

0 new messages