Bonjour,

J'ai un code Java qui fonctionne bien en local, mais je n'arrive pas à le transformer en Java Beans. EN particulier, je n'arrive pas à faire "se déclencher" le code qui se trouve dans la partie
public static void main(String[] args)

Voici la structure du code:

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
31
32
33
34
35
36
37
38
39
import java.io.IOException;
 
 
public class main {
 
 
  private static void parse(URL url, String encoding) throws IOException {
    ParserGetter kit = new ParserGetter();
    HTMLEditorKit.Parser parser = kit.getParser();
    InputStream in = url.openStream();
    InputStreamReader r = new InputStreamReader(in, encoding);
    HTMLEditorKit.ParserCallback callback = new Outliner(new OutputStreamWriter(System.out));
    parser.parse(r, callback, true);
  }
 
  public static void main(String[] args) throws Exception {
 
    ParserGetter kit = new ParserGetter();
    HTMLEditorKit.Parser parser = kit.getParser();
    String encoding = "ISO-8859-1";
 
 
    URL url = new URL("http://www.free.fr");
 
 
    InputStream in = url.openStream();
    InputStreamReader r = new InputStreamReader(in, encoding);
    // parse once just to detect the encoding
    HTMLEditorKit.ParserCallback doNothing = new HTMLEditorKit.ParserCallback();
    parser.parse(r, doNothing, true);
 
    parse(url, encoding);
  }
 
}
 
class Outliner extends HTMLEditorKit.ParserCallback { ...}
 
class ParserGetter extends HTMLEditorKit {...}

Quelq'un saurait-il comment faire ?

Merci d'avance.