Results 1 to 5 of 5
when i run this code it gives a UnKnownHost error.....plzz help me!!!
import java.net.*;
import java.io.*;
public class SourceViewer {
public static void main (String args[]){
if (args.length>0){
try{
URL ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-11-2004 #1Just Joined!
- Join Date
- Jul 2004
- Posts
- 15
help regarding java!!!
when i run this code it gives a UnKnownHost error.....plzz help me!!!
import java.net.*;
import java.io.*;
public class SourceViewer {
public static void main (String args[]){
if (args.length>0){
try{
URL u=new URL(args[0]);
URLConnection uc = u.openConnection();
InputStream in = uc.getInputStream();
in = new BufferedInputStream(in);
Reader r = new InputStreamReader(in);
int c;
while((c = r.read()) != -1){
System.out.print((char) c);
}
}
catch (MalformedURLException e) {
System.err.println(args[0] + "is not a parseable URL");
}
catch (IOException e) {
System.err.println(e);
}
}
}
}
- 08-13-2004 #2Just Joined!
- Join Date
- Aug 2004
- Posts
- 3
did you gcj for compiling...
were you able to compile the program
- 08-13-2004 #3Just Joined!
- Join Date
- Jul 2004
- Posts
- 15
yeah compilation was successful.....
- 08-13-2004 #4Just Joined!
- Join Date
- Jul 2004
- Posts
- 15
compiling was done by
./javac SourceViewer.java
run command: ./java SourceViewer http://www.google.com
result: UnKnownHostError
- 08-13-2004 #5
I don't know java yet (im taking a class this fall) but perhaps this is a DNS reolution error? ive done little programming that accesses network resources, but i always just used ips..... and they were generaly one shot deals or something just for my use. This would be better in the programming and scripting forum.


Reply With Quote
