gpt4 book ai didi

java - d 上的 UnknownHostException

转载 作者:行者123 更新时间:2023-12-01 15:12:41 25 4
gpt4 key购买 nike

我尝试运行以下示例:

http://www.sonatype.com/books/mvnex-book/reference/customizing-sect-custom-exec.html

失败的代码基本上是:

String url = "http://weather.yahooapis.com/forecastrss?p=60202";
URLConnection conn = new URL(url).openConnection();
return conn.getInputStream();

我可以从浏览器/提要阅读器完美访问 URL。然而,当在 Java 中运行代码时,我得到一个

Exception in thread "main" java.net.UnknownHostException: weather.yahooapis.com

知道,可能是什么问题?难道是我们办公室的代理阻止了该 URL,但是我可以从浏览器访问它吗?

最好,会

最佳答案

自 2019 年 1 月 3 日起,该 URL 已停用。请参阅此链接了解更多信息:

https://developer.yahoo.com/weather/

关于java - d 上的 UnknownHostException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12112462/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com