Bonjour à tous,
je me suis servis du tuto fourni par ce site pour réaliser un plannificateur de tâche, mais voici le problème, lorsque j'éxécute mon programme rien ne se passe. J'ai fait un plannificateur simplifier pour le test, celui-là ne fait que d'afficher un JOptionPane. Voici le code:Les imports sont correctes.
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
40
41
42
43
44
45
46
47
48
49
50
51
52 public class Main { /** Creates a new instance of Main */ public Main() { } /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here sched t = new sched(); } } public class task extends TimerTask{ /** Creates a new instance of task */ public task() { } public void run() { JOptionPane.showMessageDialog(null,"Bonjour Seigneur","Info",JOptionPane.INFORMATION_MESSAGE); //TODO generate report } } public class sched { /** Creates a new instance of sched */ public sched() { } public static void main(String[] args) { Timer timer = new Timer(); Calendar date = Calendar.getInstance(); date.set( Calendar.DAY_OF_WEEK, Calendar.SUNDAY ); date.set(Calendar.HOUR, 10); date.set(Calendar.MINUTE, 10); date.set(Calendar.SECOND, 0); date.set(Calendar.MILLISECOND, 0); // Schedule to run every Sunday in midnight timer.schedule( new task(), date.getTime(), 1000 * 60 * 60 * 24 * 7 ); }
Merci pour votre aide.
Flames
Partager