bonjour,
j'ai copie ce codedans le site :http://java.sun.com/j2se/1.4.2/docs/guide/security/jsse/samples/urls/URLReader.java[/URL]
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 import java.net.*; import java.io.*; /* * This example illustrates using a URL to access resources * on a secure site. * * If you are running inside a firewall, please also set the following * Java system properties to the appropriate value: * * https.proxyHost = <secure proxy server hostname> * https.proxyPort = <secure proxy server port> * */ public class URLReader { public static void main(String[] args) throws Exception { URL verisign = new URL("https://www.verisign.com/"); BufferedReader in = new BufferedReader( new InputStreamReader( verisign.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); } }
mais lors de la compilation il ma fiche les erreur suivants:
merci pour toute explicationException in thread "main" java.net.UnknownHostException: www.verisign.com
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.Socket.connect(Socket.java:483)
at java.net.Socket.connect(Socket.java:433)
at java.net.Socket.<init>(Socket.java:340)
at java.net.Socket.<init>(Socket.java:151)
at com.ibm.jsse.bv.<init>(Unknown Source)
at com.ibm.jsse.JSSESocketFactory.createSocket(Unknown Source)
at com.ibm.net.ssl.www.protocol.https.b.b(Unknown Source)
at com.ibm.net.ssl.www.protocol.http.cb.a(Unknown Source)
at com.ibm.net.ssl.www.protocol.http.cb.p(Unknown Source)
at com.ibm.net.ssl.www.protocol.https.b.<init>(Unknown Source)
at com.ibm.net.ssl.www.protocol.https.b.a(Unknown Source)
at com.ibm.net.ssl.www.protocol.https.b.a(Unknown Source)
at com.ibm.net.ssl.www.protocol.https.b.a(Unknown Source)
at com.ibm.net.ssl.www.protocol.https.q.c(Unknown Source)
at com.ibm.net.ssl.www.protocol.https.q.connect(Unknown Source)
at com.ibm.net.ssl.www.protocol.http.cj.getInputStream(Unknown Source)
at com.ibm.net.ssl.www.protocol.https.t.getInputStream(Unknown Source)
at java.net.URL.openStream(URL.java:947)
at com.bnp.url.ssl.UrlRE.main(UrlRE.java:23)
Partager