Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/376.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
javaw.exe在创建JFrame时崩溃_Java_Swing - Fatal编程技术网

javaw.exe在创建JFrame时崩溃

javaw.exe在创建JFrame时崩溃,java,swing,Java,Swing,我正在Windows7x64上使用eclipse创建一个新的Java应用程序 这是我的代码: import java.awt.EventQueue; public class Testen { private JFrame frame; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(

我正在Windows7x64上使用eclipse创建一个新的Java应用程序

这是我的代码:

import java.awt.EventQueue; public class Testen { private JFrame frame; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Testen window = new Testen(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public Testen() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { System.out.println("1"); frame = new JFrame(); System.out.println("2"); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } 导入java.awt.EventQueue; 公共类测试{ 私有JFrame; /** *启动应用程序。 */ 公共静态void main(字符串[]args){ invokeLater(新的Runnable(){ 公开募捐{ 试一试{ Testen窗口=新的Testen(); window.frame.setVisible(true); }捕获(例外e){ e、 printStackTrace(); } } }); } /** *创建应用程序。 */ 公共测试人员(){ 初始化(); } /** *初始化框架的内容。 */ 私有void初始化(){ 系统输出打印项次(“1”); frame=新的JFrame(); 系统输出打印项次(“2”); 机架立根(100450300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } 我的程序在线路上崩溃:

frame = new JFrame(); frame=新的JFrame(); 它没有给出任何错误,只是等待一两秒钟,然后我的应用程序停止运行。
在事件查看器中,我收到以下错误:

Faulting application name: javaw.exe, version: 7.0.10.8, time stamp: 0x4e8975e3 Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000 Exception code: 0xc0000005 Fault offset: 0x0000000000000000 Faulting process id: 0x1334 Faulting application start time: 0x01ccb4bf9aaa4d8d Faulting application path: C:\Program Files\Java\jre7\bin\javaw.exe Faulting module path: unknown Report Id: d9936f72-20b2-11e1-916b-904ce5de36f8 故障应用程序名称:javaw.exe,版本:7.0.10.8,时间戳:0x4e8975e3 故障模块名称:未知,版本:0.0.0.0,时间戳:0x00000000 异常代码:0xc0000005 故障偏移量:0x0000000000000000 出错进程id:0x1334 故障应用程序启动时间:0x01CCB4BF9AA4D8D 出错的应用程序路径:C:\Program Files\Java\jre7\bin\javaw.exe 故障模块路径:未知 报告Id:d9936f72-20b2-11e1-916b-904ce5de36f8

Faulting application name: javaw.exe, version: 7.0.10.8, time stamp: 0x4e8975e3 Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000 Exception code: 0xc000041d Fault offset: 0x0000000000000000 Faulting process id: 0x1334 Faulting application start time: 0x01ccb4bf9aaa4d8d Faulting application path: C:\Program Files\Java\jre7\bin\javaw.exe Faulting module path: unknown Report Id: dd4f2583-20b2-11e1-916b-904ce5de36f8 Fault bucket 2569546253, type 5 Event Name: BEX64 Response: Not available Cab Id: 0 Problem signature: P1: javaw.exe P2: 7.0.10.8 P3: 4e8975e3 P4: StackHash_1dc2 P5: 0.0.0.0 P6: 00000000 P7: 0000000000000000 P8: c0000005 P9: 0000000000000008 P10: Attached files: C:\Users\jdc\AppData\Local\Temp\WERD617.tmp.WERInternalMetadata.xml These files may be available here: C:\Users\jdc\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_javaw.exe_c49c9b915a42e5982f3a993e0cb1afabe4de2bb_168ced10 Analysis symbol: Rechecking for solution: 0 Report Id: d9936f72-20b2-11e1-916b-904ce5de36f8 Fault bucket 50876441, type 4 Event Name: APPCRASH Response: Not available Cab Id: 0 Problem signature: P1: javaw.exe P2: 7.0.10.8 P3: 4e8975e3 P4: StackHash_b541 P5: 0.0.0.0 P6: 00000000 P7: c000041d P8: 0000000000000000 P9: P10: Attached files: C:\Users\jdc\AppData\Local\Temp\WEREE86.tmp.WERInternalMetadata.xml These files may be available here: C:\Users\jdc\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_javaw.exe_936cbeffcc52c8ea801f518b59b6ee71645a626_1c350580 Analysis symbol: Rechecking for solution: 0 Report Id: dd4f2583-20b2-11e1-916b-904ce5de36f8 Report Status: 0 故障应用程序名称:javaw.exe,版本:7.0.10.8,时间戳:0x4e8975e3 故障模块名称:未知,版本:0.0.0.0,时间戳:0x00000000 异常代码:0xc000041d 故障偏移量:0x0000000000000000 出错进程id:0x1334 故障应用程序启动时间:0x01CCB4BF9AA4D8D 出错的应用程序路径:C:\Program Files\Java\jre7\bin\javaw.exe 故障模块路径:未知 报告Id:dd4f2583-20b2-11e1-916b-904ce5de36f8

Faulting application name: javaw.exe, version: 7.0.10.8, time stamp: 0x4e8975e3 Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000 Exception code: 0xc000041d Fault offset: 0x0000000000000000 Faulting process id: 0x1334 Faulting application start time: 0x01ccb4bf9aaa4d8d Faulting application path: C:\Program Files\Java\jre7\bin\javaw.exe Faulting module path: unknown Report Id: dd4f2583-20b2-11e1-916b-904ce5de36f8 Fault bucket 2569546253, type 5 Event Name: BEX64 Response: Not available Cab Id: 0 Problem signature: P1: javaw.exe P2: 7.0.10.8 P3: 4e8975e3 P4: StackHash_1dc2 P5: 0.0.0.0 P6: 00000000 P7: 0000000000000000 P8: c0000005 P9: 0000000000000008 P10: Attached files: C:\Users\jdc\AppData\Local\Temp\WERD617.tmp.WERInternalMetadata.xml These files may be available here: C:\Users\jdc\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_javaw.exe_c49c9b915a42e5982f3a993e0cb1afabe4de2bb_168ced10 Analysis symbol: Rechecking for solution: 0 Report Id: d9936f72-20b2-11e1-916b-904ce5de36f8 Fault bucket 50876441, type 4 Event Name: APPCRASH Response: Not available Cab Id: 0 Problem signature: P1: javaw.exe P2: 7.0.10.8 P3: 4e8975e3 P4: StackHash_b541 P5: 0.0.0.0 P6: 00000000 P7: c000041d P8: 0000000000000000 P9: P10: Attached files: C:\Users\jdc\AppData\Local\Temp\WEREE86.tmp.WERInternalMetadata.xml These files may be available here: C:\Users\jdc\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_javaw.exe_936cbeffcc52c8ea801f518b59b6ee71645a626_1c350580 Analysis symbol: Rechecking for solution: 0 Report Id: dd4f2583-20b2-11e1-916b-904ce5de36f8 Report Status: 0 故障桶2569546253,类型5 活动名称:BEX64 答复:没有 驾驶室Id:0 问题签名: P1:javaw.exe P2:7.0.10.8 P3:4e8975e3 P4:StackHash_1dc2 P5:0.0.0.0 P6:00000000 P7:0000000000000000 P8:c0000005 P9:0000000000000008 P10: 附件: C:\Users\jdc\AppData\Local\Temp\WERD617.tmp.WERInternalMetadata.xml 这些文件可能在以下位置可用: C:\Users\jdc\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_javaw.exe_c49c9b915a42e5982f3a993e0cb1afabe4de2bb_168ced10 分析符号: 重新检查解决方案:0 报告Id:d9936f72-20b2-11e1-916b-904ce5de36f8

Faulting application name: javaw.exe, version: 7.0.10.8, time stamp: 0x4e8975e3 Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000 Exception code: 0xc000041d Fault offset: 0x0000000000000000 Faulting process id: 0x1334 Faulting application start time: 0x01ccb4bf9aaa4d8d Faulting application path: C:\Program Files\Java\jre7\bin\javaw.exe Faulting module path: unknown Report Id: dd4f2583-20b2-11e1-916b-904ce5de36f8 Fault bucket 2569546253, type 5 Event Name: BEX64 Response: Not available Cab Id: 0 Problem signature: P1: javaw.exe P2: 7.0.10.8 P3: 4e8975e3 P4: StackHash_1dc2 P5: 0.0.0.0 P6: 00000000 P7: 0000000000000000 P8: c0000005 P9: 0000000000000008 P10: Attached files: C:\Users\jdc\AppData\Local\Temp\WERD617.tmp.WERInternalMetadata.xml These files may be available here: C:\Users\jdc\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_javaw.exe_c49c9b915a42e5982f3a993e0cb1afabe4de2bb_168ced10 Analysis symbol: Rechecking for solution: 0 Report Id: d9936f72-20b2-11e1-916b-904ce5de36f8 Fault bucket 50876441, type 4 Event Name: APPCRASH Response: Not available Cab Id: 0 Problem signature: P1: javaw.exe P2: 7.0.10.8 P3: 4e8975e3 P4: StackHash_b541 P5: 0.0.0.0 P6: 00000000 P7: c000041d P8: 0000000000000000 P9: P10: Attached files: C:\Users\jdc\AppData\Local\Temp\WEREE86.tmp.WERInternalMetadata.xml These files may be available here: C:\Users\jdc\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_javaw.exe_936cbeffcc52c8ea801f518b59b6ee71645a626_1c350580 Analysis symbol: Rechecking for solution: 0 Report Id: dd4f2583-20b2-11e1-916b-904ce5de36f8 Report Status: 0 故障桶50876441,类型4 事件名称:APPCRASH 答复:没有 驾驶室Id:0 问题签名: P1:javaw.exe P2:7.0.10.8 P3:4e8975e3 P4:StackHash_b541 P5:0.0.0.0 P6:00000000 P7:c000041d P8:0000000000000000 第9页: P10: 附件: C:\Users\jdc\AppData\Local\Temp\WEREE86.tmp.WERInternalMetadata.xml 这些文件可能在以下位置可用: C:\Users\jdc\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash\u javaw.exe\u 936cbeffcc52c8ea801f518b59b6ee71645a626\u 1c350580 分析符号: 重新检查解决方案:0 报告Id:dd4f2583-20b2-11e1-916b-904ce5de36f8 报告状态:0 有人知道如何解决这个问题吗?或者我应该从哪里开始寻找解决方案

编辑:


这在linux下工作得非常好。(最大的区别是java版本)

除了缺少的
导入之外,没有其他内容


import javax.swing.JFrame

其他java程序在我的机器上也有问题

import java.awt.EventQueue;  
import javax.swing.JFrame;

public class Testen {

    private JFrame frame;

    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    Testen window = new Testen();
                    window.frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /**
     * Create the application.
     */
    public Testen() {
        initialize();
    }

    /**
     * Initialize the contents of the frame.
     */
    private void initialize() {
        System.out.println("1");
        frame = new JFrame();
        System.out.println("2");
        frame.setBounds(100, 100, 450, 300);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

}

完全卸载并重新安装所有java组件修复了它。我想我永远也不会知道真正的原因-(

嘿,我好像忘了复制我的第一行,它是import javax.swing.JFrame,所以这对我没有帮助。当没有导入时,程序不会启动。我的程序启动了,但意外地结束了,即使没有点击任何catch.System.out.println(“1”);显示为System.out.println(“2”);从未显示。@JDC此程序对我来说运行良好,在netbeans中,打印了1和2。将代码复制粘贴到netbeans 7.1 rc1中,按预期工作……它也可以在我的虚拟WinXP测试机上工作。我想让它在我的开发机上工作。我在10个测试中的1个测试中遇到了完全相同的问题(假设)配置相同的windows 7 64位计算机。发生在一个除了实例化JFrame之外什么都不做的程序上。你找到答案了吗?我一直不知道为什么。它是在一台有很多java更新的“旧”计算机上…我全部卸载了。并且进行了干净的java安装。这对我很有帮助。