Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Cannot find Symbol: Method error with getResponseCode

843789Apr 25 2010 — edited Apr 25 2010
Hi, I'm having trouble getting my program to compile with the following error:

lineCheckerV2.java:97: cannot find symbol
symbol : method getResponseCode()
location: class java.net.URLConnection
int code = conn.getResponseCode();

I have imported the following packages (made sure I have the latest versions as well)
import java.net.*;
import java.net.URLConnection.*;	
import java.net.HttpURLConnection.*;
import java.net.URL.*;
import java.io.*;
import javax.swing.*;
import javax.swing.text.html.parser.*;
import javax.swing.text.html.*;
import javax.swing.text.*;
import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLEditorKit;
import java.util.*;
import java.util.List.*;
here is the offending code
	List<String> result = new ArrayList<String>(getLinks(args[0])); 	
	   			
   		int n = result.size();
    		for(int i = 0; i < n ; i++)
    		{
      		System.out.println( result.get(i) );
      		URL link = new URL( result.get(i) );
		URLConnection conn = link.openConnection();
		int code = conn.getResponseCode();
		System.out.println("rescode = " + code);
		}
^

Any ideas - I'm pulling my hair out here...

thanks in advance

Edited by: alarm on Apr 25, 2010 3:08 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 23 2010
Added on Apr 25 2010
2 comments
644 views