Find the answer to your Linux question:
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.
  1. #1
    Just 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);
    }
    }
    }
    }

  2. #2
    Just Joined!
    Join Date
    Aug 2004
    Posts
    3
    did you gcj for compiling...
    were you able to compile the program

  3. #3
    Just Joined!
    Join Date
    Jul 2004
    Posts
    15
    yeah compilation was successful.....

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Jul 2004
    Posts
    15
    compiling was done by
    ./javac SourceViewer.java
    run command: ./java SourceViewer http://www.google.com
    result: UnKnownHostError

  6. #5
    Linux Guru kkubasik's Avatar
    Join Date
    Mar 2004
    Location
    Lat: 39:03:51N Lon: 77:14:37W
    Posts
    2,396
    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.
    Avoid the Gates of Hell. Use Linux
    A Penny for your Thoughts

    Formerly Known as qub333

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •