Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I found this example, but NetBeans point on error in "import java.net"(seems, unknown name)
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();
}
}

Thanks.
Posted
Updated 3-Jul-10 10:35am
v3

If you are developing using the CLDC option then java.net is not part of the distribution. See the documentation here[^].
 
Share this answer
 
try to use command line, for testing it & see if your Netbeans imports this lib, but! java.net exists in rt.jar file! (in SE)

$ javac URLReader.java
$ java URLReader or java -cp . URLReader


or use another lib example http://www.wirelessdevnet.com/channels/java/features/j2me_http.phtml (Tags: J2ME)
 
Share this answer
 
Comments
Richard MacCutchan 4-Jul-10 2:45am    
He tagged his post J2ME so it does not use the standard library.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900