阅读网页上的文字 [英] Read text from web-page
本文介绍了阅读网页上的文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我找到了这个示例,但是NetBeans指出"import java.net"中的错误(似乎是未知名称)
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();
}
}
谢谢.
推荐答案
如果使用CLDC选项进行开发,则java.net不属于发行版.请参见文档此处 [
If you are developing using the CLDC option then java.net is not part of the distribution. See the documentation here[^].
尝试使用命令行进行测试和测试;看看您的Netbeans是否导入了该库,但! rt.jar文件中存在java.net! (在SE中)
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
javac URLReader.java
这篇关于阅读网页上的文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文