回 帖 发 新 帖 刷新版面

主题:请教高手一个   关于图形界面程序运行的问题!!!!!!!!!!!

[size=6][size=5][size=4][size=3] 为什么我的GUI经过了编译器的编译;
  
   后运行显示异常:

   Exception in thread "main" java.lang.UnsupportedClassVersionError:

   Bad version number in .class file

  说的是版本的问题,但是我是下的最新的jdk呀!!!!!!!!!!

   请高手指点一下!!!!!!!

   谢谢!!!!!!!!!!![/size][/size][/size][/size][em18][em18][em18]
import java.awt.*;
 public class Guidemo
 {
  Frame f;
  Label b1,b11,b12,b13,b14;
  TextField userId,oldpass,newPass,confirmpass;
  Button okB,cancelB;
  public void display()
  {
  f=new Frame("修改密码");
  f.setSize(260,180);
  f.setBackground(Color.lightGray);
  f.setLocation(300,400);
  f.setLayout(new FlowLayout());
  b11=new Label("请输入用户id");
  b12=new Label("请输入新密码");
  b13=new Label("请输入新码");
  b14=new Label("请确认新密码");
  userId=new TextField("shuru",15);
  oldpass=new TextField(15);
  newPass=new TextField(15);
  confirmpass= new TextField(15);
  okB=new Button("确定");
  cancelB= new Button("取消");
  f.add(b11);   f.add(userId);
  f.add(b12);   f.add(oldpass);
  f.add(b13);   f.add(newPass);
  f.add(b14);   f.add(confirmpass);
  f.add(okB);  f.add(cancelB);
  f.setVisible(true);
  }
  public static void main(String arg[])
  {
  new Guidemo().display();
  }
 }

回复列表 (共1个回复)

沙发

Your machine might have old Microsoft jvm or other old version on it.

on cmd/dos, type

[color=red][b]java -version[/b][/color]

If the result is not the java version you expected., then that is the problem.

Get rid of the old version, put your installed_dir\jre1.5.0_12\bin on your [b]Path[/b] environmental variable.

我来回复

您尚未登录,请登录后再回复。点此登录或注册