public void widgetSelected(SelectionEvent arg0) {
Cserver =new ChatServer();
serverDialog = new ConfigureServerInfo()
}ChatServer和ConfigureServerInfo是另外两个类文件,调试时ChatServer类可以正确的new出来,但是ConfigureServerInfo类却跟到了如下代码中
private synchronized Class loadClassInternal(String name)
throws ClassNotFoundException
    {
return loadClass(name);
    }
上面代码时java自带代码。
请高手帮忙看下,其中IDE编译没有错误。

解决方案 »

  1.   

    这两个类都是我自己写的,而且程序是可以正确运行的,只是点了button后,触发上面代码,不能new出一个窗口来!
    楼上的对应的包具体指什么?
      

  2.   

    //ChatServer.java
    /*
     * 创建日期 2007-1-9
     *
     * TODO 要更改此生成的文件的模板,请转至
     * 窗口 - 首选项 - Java - 代码样式 - 代码模板
     *//**
     * @author Administrator
     *
     * TODO 要更改此生成的类型注释的模板,请转至
     * 窗口 - 首选项 - Java - 代码样式 - 代码模板
     */
    public class ChatServer {
    // ServerInterface serverInterface; public static void main(String[] args) {
    new ServerInterface();

    }
    }//ServerInterface.java
    import org.eclipse.swt.SWT;
    import org.eclipse.swt.events.SelectionAdapter;
    import org.eclipse.swt.events.SelectionEvent;
    import org.eclipse.swt.widgets.Button;
    import org.eclipse.swt.widgets.Display;
    import org.eclipse.swt.widgets.Shell;/*
     * 创建日期 2007-1-9
     *
     * TODO 要更改此生成的文件的模板,请转至
     * 窗口 - 首选项 - Java - 代码样式 - 代码模板
     *//**
     * @author Administrator
     *
     * TODO 要更改此生成的类型注释的模板,请转至
     * 窗口 - 首选项 - Java - 代码样式 - 代码模板
     */
    public class ServerInterface { /**
     * Launch the application
     * @param args
     */
    public ServerInterface() {
    final Display display = Display.getDefault();
    final Shell shell = new Shell();
    shell.setSize(500, 375);
    shell.setText("SWT Application");
    // shell.open(); final Button bConfigure = new Button(shell, SWT.NONE);
    bConfigure.addSelectionListener(new SelectionAdapter() {
    public void widgetSelected(SelectionEvent arg0) {         //就是下面这个对象new 不出来
    ConfigureServerInfo configureServerInfo =new ConfigureServerInfo(shell);
    }
    });
    bConfigure.setText("bConfigure");
    bConfigure.setBounds(110, 256, 44, 23);
    shell.layout();
    while (!shell.isDisposed()) {
    if (!display.readAndDispatch())
    display.sleep();
    }
    }
    }//ConfigureServerInfo.java
    import org.eclipse.swt.SWT;
    import org.eclipse.swt.widgets.Dialog;
    import org.eclipse.swt.widgets.Display;
    import org.eclipse.swt.widgets.Shell;
    /*
     * 创建日期 2007-1-9
     *
     * TODO 要更改此生成的文件的模板,请转至
     * 窗口 - 首选项 - Java - 代码样式 - 代码模板
     *//**
     * @author Administrator
     *
     * TODO 要更改此生成的类型注释的模板,请转至
     * 窗口 - 首选项 - Java - 代码样式 - 代码模板
     */
    public class ConfigureServerInfo extends Dialog { protected Object result; protected Shell shell; /**
     * Create the dialog
     * @param parent
     * @param style
     */
    public ConfigureServerInfo(Shell parent, int style) {
    super(parent, style);
    } /**
     * Create the dialog
     * @param parent
     */
    public ConfigureServerInfo(Shell parent) {
    this(parent, SWT.NONE);
    } /**
     * Open the dialog
     * @return the result
     */
    public Object open() {
    createContents();
    shell.open();
    shell.layout();
    Display display = getParent().getDisplay();
    while (!shell.isDisposed()) {
    if (!display.readAndDispatch())
    display.sleep();
    }
    return result;
    } /**
     * Create contents of the dialog
     */
    protected void createContents() {
    shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
    shell.setSize(500, 375);
    shell.setText("SWT Dialog");
    //
    }
    }
      

  3.   

    就是//ServerInterface.java中的
     //就是下面这个对象new 不出来
    ConfigureServerInfo configureServerInfo =new ConfigureServerInfo(shell);
      

  4.   

    就算在//ServerInterface.java中的那个位置new下面这个简单的test类也不行,奇怪,但在那里new ChatServer()就可以。public class test { /**
     * 
     */
    public test() {

    // TODO 自动生成构造函数存根
    }}
      

  5.   

    import org.eclipse.swt.SWT;
    import org.eclipse.swt.widgets.Dialog;
    import org.eclipse.swt.widgets.Display;
    import org.eclipse.swt.widgets.Shell;这个包我没有 T_T  
    我重现不了你的问题了...555555555555555
      

  6.   

    //testA.javapublic class testA { public static void main(String[] args) {
    new testB();
    }
    }//testC.java
    public class testC { /**
     * 
     */
    public testC() {

    // TODO 自动生成构造函数存根
    }}
    //testC.java
    public class testC { /**
     * 
     */
    public testC() {

    // TODO 自动生成构造函数存根
    }}
    //testB.java
    public class testB { /**
     * 
     */
    public testB() {
    new testC();
    new testA();

    // TODO 自动生成构造函数存根
    }}我在//testB.java文件中new testC();处设置断点调试,new testC();时失败,new testA();可以成功,搞了很久实在是搞不清楚为什么?请指点下
      

  7.   

    上面的也有同样问题,请haisenmai(我应该做得到) 帮忙看下
      

  8.   

    楼主看看是不是classpath的问题?三个类是放在一个package下面的吧
      

  9.   

    是在一个包下,如果不是一个包下ide就会提示有错的
      

  10.   

    解决了,原来new的时候,会跳动java自带的如下代码中
    private synchronized Class loadClassInternal(String name)
    throws ClassNotFoundException
        {
    return loadClass(name);
        }我以为异常了,就是new失败了,其实是正常的,继续运行后边会new的。