Results 1 to 5 of 5
  1. #1
    Lil_Aziz1's Avatar
    Lil_Aziz1 is offline Senior Member
    Join Date
    Dec 2009
    Location
    United States
    Posts
    343
    Rep Power
    5

    Default Reading Directly from a URL [help]

    Hi everyone. I am new here and I am 85% sure this is the right forum to post this question on.

    I was exploring the java.sun.com site and I got stuck on this site: http://java.sun.com/docs/books/tutor...eadingURL.html

    Java Code:
    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();
        }
    }
    On the bottom, it says I might have to set the proxy host so the program can find the Yahoo! server. It linked me to this site:
    http://java.sun.com/docs/books/tutor..._setProxy.html

    I did what it told me to do on cmd (java -Dhttp.proxyHost=yahoo.com)
    I am still getting the same error on eclipse:


    Exception in thread "main" java.lang.Error: Unresolved compilation problem:
    at TestingHere.main(TestingHere.java:8)

    Can someone please help me out? Also, I have some extra questions:
    What is a proxyhost? How can I find out what the proxyhost is set to on my computer? Will changing the proxyhost from the java command affect Firefox or IE?

    Extra information: I am using Windows 7 Home Premium Upgrade
    Last edited by Lil_Aziz1; 01-02-2010 at 09:07 PM. Reason: MY post count is 20+ so I am capable of putting the code up

  2. #2
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    8

    Default

    Basically, your code isn't compiling. Find out what the error is...

  3. #3
    Lil_Aziz1's Avatar
    Lil_Aziz1 is offline Senior Member
    Join Date
    Dec 2009
    Location
    United States
    Posts
    343
    Rep Power
    5

    Default

    I obviously see it's not compiling because it's giving me an exception that's been posted up on the first post. I don't know what the error is. I think it has something to do w/ proxy host because the Sun's Tutorial said so on the site. (which is also posted on the first post) The Sun's Tutorial said I should change the proxy host so the program can find the Yahoo! server. I don't know what proxy host to set it to.

  4. #4
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,236
    Rep Power
    7

    Default

    I doubt it has anything to do with the proxy host.

    The error says the problem is in a class named "TestingHere", which you haven't posted the code for, so I don't know what the problem is.

  5. #5
    Lil_Aziz1's Avatar
    Lil_Aziz1 is offline Senior Member
    Join Date
    Dec 2009
    Location
    United States
    Posts
    343
    Rep Power
    5

    Default

    TestingHere is the same as URLReader but it doesn't matter now because it's working! :)

Similar Threads

  1. sending data to printer directly
    By Abhinav.k in forum Advanced Java
    Replies: 4
    Last Post: 12-09-2009, 08:26 AM
  2. Storing objects directly with db4o
    By german in forum JDBC
    Replies: 0
    Last Post: 05-12-2009, 09:22 PM
  3. Display process bar in cell directly with Java reporting tool
    By freezea in forum Reviews / Advertising
    Replies: 0
    Last Post: 05-10-2009, 05:11 AM
  4. Can I call directly the *.class
    By doanhanam in forum New To Java
    Replies: 1
    Last Post: 11-16-2008, 08:24 PM
  5. How to draw directly on an SWT Control
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-02-2008, 08:51 PM

Tags for this Thread

Posting Permissions

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