Criei um programa Swing simples pelo eclipse que é:
/*
- Created on 08/06/2005
- TODO To change the template for this generated file go to
- Window - Preferences - Java - Code Style - Code Templates
*/
package teste;
import javax.swing.JFrame;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
/**
-
@author usiario
-
TODO To change the template for this generated type comment go to
-
Window - Preferences - Java - Code Style - Code Templates
*/
public class Test extends JFrame {private javax.swing.JPanel jContentPane = null; private JCheckBox jCheckBox = null; private JLabel jLabel = null; /**
- This method initializes jCheckBox
-
@return javax.swing.JCheckBox
/
private JCheckBox getJCheckBox() {
if (jCheckBox == null) {
try {
jCheckBox = new JCheckBox();
jCheckBox.setBounds(54, 68, 21, 17); // Generated
jCheckBox.setText(""); // Generated
jCheckBox.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent e) {
System.out.println(“mouseEntered()”); // TODO Auto-generated Event stub mouseEntered()
jLabel.setText(“I’m here…”);
}
});
jCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println(“actionPerformed()”); // TODO Auto-generated Event stub actionPerformed()
jLabel.setText(jCheckBox.isSelected() ? “Checked” : “Unchecked”);
}
});
}
catch (java.lang.Throwable e) {
// TODO: Something
}
}
return jCheckBox;
}
public static void main(String[] args) {
Test test = new Test();
test.setDefaultCloseOperation(EXIT_ON_CLOSE);
test.setVisible(true);
}
/* - This is the default constructor
/
public Test() {
super();
initialize();
}
/* - This method initializes this
-
@return void
/
private void initialize() {
this.setSize(300,200);
this.setContentPane(getJContentPane());
this.setTitle(“JFrame”);
}
/* - This method initializes jContentPane
-
@return javax.swing.JPanel
*/
private javax.swing.JPanel getJContentPane() {
if(jContentPane == null) {
jLabel = new JLabel();
jContentPane = new javax.swing.JPanel();
jContentPane.setLayout(null);
jLabel.setBounds(86, 68, 70, 17); // Generated
jLabel.setText(""); // Generated
jContentPane.add(getJCheckBox(), null); // Generated
jContentPane.add(jLabel, null); // Generated
}
return jContentPane;
}
}
Quando rodo pelo eclipse funciona bem, mas quando tento rodar pelo atalho, ou pelo prompt(javaw Test, dentro do diretorio do .class), vem a mensagem: “Could not find the main class. Program will exit.”
Já segui os passos para o atalho:
Destino: C:\j2sdk1.4.2_06\bin\javaw.exe Test
Iniciar em C:\eclipse\workspace\Swing (que é o raiz da aplicação);
Alguém pode me ajudar???
Renato 
