我想把一个Applet打包成可执行的jar文件 我自己创建了一个MANIFEST.mf 文件里面是
Main-Class: com.Login\n
可以打包成jar文件 但是没有办法执行 出错了
Failed to load Main-Class manifest attribute from
E:\Eclipse\Texiao\src\loin.jar
请问应该怎么做
[此贴子已经被作者于2007-6-23 22:18:03编辑过]
我的Login.class
package com;
import java.io.*;
import java.net.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.Timer;
public class Login extends JFrame implements ActionListener
{
JLabel lblUserName;
JLabel lblUserPwd;
JTextField txtUsrName;
JPasswordField txtUsrPwd;
JButton btnLogin;
JButton btnCancel;
JButton btnRegister;
String UsrName;
char[] UsrPwd;
String strPwd;
Socket toServer;
ObjectInputStream streamFromServer;
PrintStream streamToServer;
public Login(){
this.setTitle("登陆");
JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout());
GridBagConstraints gbCons = new GridBagConstraints();
gbCons.gridx = 0;
gbCons.gridy = 0;
lblUserName = new JLabel("用户名");
panel.add(lblUserName,gbCons);
gbCons.gridx = 1;
gbCons.gridy = 0;
txtUsrName = new JTextField(20);
panel.add(txtUsrName,gbCons);
gbCons.gridx = 0;
gbCons.gridy = 1;
lblUserPwd = new JLabel("密码");
panel.add(lblUserPwd,gbCons);
gbCons.gridx = 1;
gbCons.gridy = 1;
txtUsrPwd = new JPasswordField(20);
panel.add(txtUsrPwd,gbCons);
JPanel btnPanel = new JPanel();
btnLogin = new JButton("登陆");
btnPanel.add(btnLogin);
btnLogin.addActionListener(this);
btnRegister = new JButton("注册");
btnPanel.add(btnRegister);
btnRegister.addActionListener(this);
btnCancel = new JButton("取消");
btnPanel.add(btnCancel);
btnCancel.addActionListener(this);
gbCons.gridx = 1;
gbCons.gridy = 3;
gbCons.anchor = GridBagConstraints.EAST;
panel.add(btnPanel,gbCons);
this.getContentPane().add(panel);
this.setVisible(true);
this.setSize(450,200);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
void showdlg(){
JOptionPane.showMessageDialog(this,
"用户名密码不正确","错误信息",JOptionPane.ERROR_MESSAGE);
}
public void actionPerformed(ActionEvent e) {
JButton button = (JButton) e.getSource();
if(button.equals(btnCancel)){
this.dispose();
}
else if(button.equals(btnRegister))
{
//new Register();//调用注册程序
this.dispose();
}else{
try{
toServer = new Socket("机器名",1001);
streamFromServer = new ObjectInputStream(toServer.getInputStream());
streamToServer = new PrintStream(toServer.getOutputStream());
streamToServer.print("登陆信息");
UsrName = txtUsrName.getText();
UsrPwd = txtUsrPwd.getPassword();
strPwd = new String(UsrPwd);
streamToServer.println(UsrName+":"+UsrPwd);
String fromServer = (String)streamFromServer.readObject();
if(fromServer.equals("欢迎")){
//new clientInt(UsrName);
this.dispose();
}
else{
this.showdlg();
}
}
catch(Exception el)
{
System.out.println("发生异常:"+el.toString());
}
}
}
public static void main(String args[]){
new Login();
}
}
这个不会什么错吧