when i double click on jar file, I get error "Could not find the main class. Program will exit!" inspite of main class being defined in manifest. Any idea what I am missing?
Details:
'perfagent' is package in which Agent class is present
|***** Jar File content ****|
Agent$1.class
Agent.class
Manifest.mf
|**** Manifest File ****|
Manifest-Version: 1.0
Ant-Version: Apache
Ant 1.6.2
Created-By: 1.5.0-b64 (Sun Microsystems Inc.)
Main-Class: perfagent.Agent
X-COMMENT: Main-Class will be added automatically by build
|**** Agent class ****|
package perfagent;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Agent extends JFrame {
JTextField tField1;
JTextField tField2;
/** Creates a new instance of Main */
public Agent() {
initComponents();
}
/**
* @param args the command line arguments
*/
public static void main(
String[] args) {
// TODO code application logic here
Agent ag1 = new Agent();
}
private void initComponents() {
JPanel panel1 = new JPanel();
JButton button1 = new JButton("Continue");
JLabel label1 = new JLabel("Fahrenheit");
JLabel label2 = new JLabel("Celsius");
tField1 = new JTextField("Enter Temp in F");
tField2 = new JTextField("Temp in Celcius");
button1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
tField2.setText(String.valueOf((Float.valueOf(tField1.getText()) - 32)*5/9));
}
});
panel1.add(label1);
panel1.add(tField1);
panel1.add(label2);
panel1.add(tField2);
panel1.add(button1);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.getContentPane().add(panel1);
this.pack();
this.setVisible(true);
}
}