java swing运行没反应_java – 无法从命令行运行swing

我在

windows中使用命令行来编译然后执行我的

java程序.我已经去了

http://java.sun.com/docs/books/tutorial/uiswing/start/compile.html并尝试编译HelloWorldSwing.java类.它工作,但当我尝试“java HelloWorldSwing”它给了我一堆错误,并在线程“主”java.lang.NoClassDefFoundError:错误的名称:开始/ HelloWorldSwing中说出一些异常的行.

我尝试使用java start / HelloWorldSwing运行,它说noClassDefFoundError.我也没有javac的错误.这是教程中的代码:

import javax.swing.*;

public class HelloWorldSwing {

/**

* Create the GUI and show it. For thread safety,

* this method should be invoked from the

* event-dispatching thread.

*/

private static void createAndShowGUI() {

//Create and set up the window.

JFrame frame = new JFrame("HelloWorldSwing");

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//Add the ubiquitous "Hello World" label.

JLabel label = new JLabel("Hello World");

frame.getContentPane().add(label);

//Display the window.

frame.pack();

frame.setVisible(true);

}

public static void main(String[] args) {

//Schedule a job for the event-dispatching thread:

//creating and showing this application's GUI.

javax.swing.SwingUtilities.invokeLater(new Runnable() {

public void run() {

createAndShowGUI();

}

});

}

}

编辑:使用javaw

窗口弹出

“发生Java异常”

另一个窗口

“错误:无法找到主类.

错误:发生了jni错误,请检查您的安装并重试.“

从来没有运行任何java程序的任何问题,我错过了什么?有没有办法知道它是什么?

我也在.java和.class所在的同一路径中运行命令.

我编译程序的路径中没有文件夹启动.

EDIT2

我用java尝试了start / HelloWorldSwing和HelloWorldSwing.

我也没有与javac有任何错误.当我使用javaw并且java给我NoClassDefFoundException时,我得到2个弹出窗口,其中包含我之前输入的消息,然后讨论ClassLoaders和诸如此类的东西.

EDIT3

我通过删除“包开始”让它工作了线.我需要做些什么来使它与它一起工作?

javaw现在也可以删除包行.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值