用eclipse运行java源程序后生成错误信息提示:could not find the main class program will exit

来源:百度知道 编辑:UC知道 时间:2024/06/16 20:05:16
我所运行的这个程序是没有问题的,因为用JCreartor运行过,该程序是这样的:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class GoodLucky extends JFrame implements ActionListener{

JTextField tf = new JTextField();
JButton b1 = new JButton("��ʼ��");
JButton b2 = new JButton("����");
boolean isGo = false;
public GoodLucky(){
b1.setActionCommand("start");
JPanel p = new JPanel();
p.add(b1);
p.add(b2);

b1.addActionListener(this);
b2.addActionListener(this);
b2.setEnabled(false);

this.getContentPane().add(tf,"North");
this.getContentPane().add(p,"South");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(300,200);
this.setLocation(300,300);
Cursor cu = new Cursor(Cursor.HAND_CURSOR);
this.setCurs

知道了..你在eclipse里面还没有保存吧....右键你的工程,properties--->Info--->Text file encoding下面的other选UTF-8..-->Apply-->ok
因为你在JCreartor是以UTF-8保存的..运行就OK了..
运行是:右键你的那个类-->run as

有可能是jdk配置的问题,你看看你的JDK配置正确没的