Je debute en java.
Je prend le tuto :
http://baptiste-wicht.developpez.com...page=page_1#LI

En gros voila mon 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
40
41
 
package uto_swing.Chapitre1.Etape1;
import javax.swing.*;
 
public class SimpleFenetre extends JFrame
{
 
	public SimpleFenetre() 
	{		
		super();
		build();//On initialise notre fenêtre
 
	}
 
	private void build(){
		this.setTitle("Ma première application"); //On donne un titre à l'application
		this.setSize(320,240); //On donne une taille à notre fenêtre
		this.setLocationRelativeTo(null); //On centre la fenêtre sur l'écran
		this.setResizable(false) ; //On interdit la redimensionnement de la fenêtre
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //On dit à l'application de se fermer
		//lors du clic sur la croix
	}
 
 
	/**
         * @param args
         */
	public static void main(String[] args) 
	{
		// TODO Raccord de méthode auto-généré
		SwingUtilities.invokeLater(new Runnable(){
			public void run(){
				//On crée une nouvelle instance de notre fenêtre
				SimpleFenetre gui = new SimpleFenetre(); 
				gui.setVisible(true);//On la rend visible
			}
		});
 
	}
 
}
Execution en ligne de commande :
javac uto_swing/Chapitre1/Etape1/SimpleFenetre.java
java uto_swing.Chapitre1.Etape1.SimpleFenetre

Ma premiere fenetre s'affiche

Depuis eclipse : executer en tant application :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
Exception in thread "main" java.lang.ClassFormatError: uto_swing.Chapitre1.Etape1.SimpleFenetre (unrecognized class file version)
   at java.lang.VMClassLoader.defineClass(libgcj.so.70)
   at java.lang.ClassLoader.defineClass(libgcj.so.70)
   at java.security.SecureClassLoader.defineClass(libgcj.so.70)
   at java.net.URLClassLoader.findClass(libgcj.so.70)
   at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.70)
   at java.lang.ClassLoader.loadClass(libgcj.so.70)
   at java.lang.ClassLoader.loadClass(libgcj.so.70)
   at gnu.java.lang.MainThread.run(libgcj.so.70)
Ca doit pas etre grand chose mais je vois pas !