I am following the The JavaT Tutorials > Custom Networking > Working with
URLs trail. The following code compiles with no complaints:
import java.net.*;
import java.io.*;
public class URLReader {
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();
}
}
When I run it, I get Exception in thread "main"
java.lang.NoClassDefFoundError: URLReader. I am working on my home computer
without a proxy, as far as I know. I tried disabling my firewall
temporarily but it did not help.Any suggestions?Thanks,Tharpa
IchBin - 19 Aug 2006 01:21 GMT
> I am following the The JavaT Tutorials > Custom Networking > Working with
> URLs trail. The following code compiles with no complaints:
[quoted text clipped - 21 lines]
> without a proxy, as far as I know. I tried disabling my firewall
> temporarily but it did not help.Any suggestions?Thanks,Tharpa
The code runs fine on my Windoze XP SP 2 machine with jdk1.5.0_07 under
Eclipse 3.2
Depends, how are you tying to run your URLReader.class file? You just
need to CD to that directory where your URLReader.class is and issue:
Java URLReader
--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Tharpa Roberts - 20 Aug 2006 02:50 GMT
IchBin,
For some reason, it works this time. I'm sure what went wrong yesterday.
Thanks anyway.
Tharpa
> The code runs fine on my Windoze XP SP 2 machine with jdk1.5.0_07
> under Eclipse 3.2
[quoted text clipped - 3 lines]
>
> Java URLReader

Signature
May all beings, in or out of the womb, be well, happy and peaceful.
http://mysite.verizon.net/tharpa/
Sigmund Hansen - 19 Aug 2006 02:30 GMT
> I am following the The JavaT Tutorials > Custom Networking > Working with
> URLs trail. The following code compiles with no complaints:
[quoted text clipped - 21 lines]
> without a proxy, as far as I know. I tried disabling my firewall
> temporarily but it did not help.Any suggestions?Thanks,Tharpa
java -cp . URLReader
not:
java URLReader
You should set this up in your classpath environment variable... Then
you don't have to specify the cp all the time...
Tharpa Roberts - 20 Aug 2006 02:51 GMT
Dear Sigmund,
For some reason, it works this time. I'm not sure what went wrong
yesterday.
Thanks anyway.
Tharpa
> java -cp . URLReader
> not:
> java URLReader
>
> You should set this up in your classpath environment variable... Then
> you don't have to specify the cp all the time...

Signature
May all beings, in or out of the womb, be well, happy and peaceful.
http://mysite.verizon.net/tharpa/