我正在尝试从URL中读取内容,但是我的程序不断出现此错误:
java.io.IOException: Server returned HTTP response code: 403 for URL: https://www.google.com/search?q=weather+in+seattle&oq=weather+in+sea&aqs=chrome.0.0l3j69i57j0l2.4686j0j4&sourceid=chrome&ie=UTF-8
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1913)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1509)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:245)
at java.base/java.net.URL.openStream(URL.java:1117)
at Main.main(Main.java:17)
线程“主”中的异常java.lang.NullPointerException 在Main.main(Main.java:25)
该如何解决?