所以我遇到了一个问题,如果我只是点击没有组件的框架中的一个键,它会给我一个错误。我试过没有任何组件,但即使没有组件,这个错误也会继续出现。即使我尝试了另一个新鲜的,这个错误仍然会发生。它始终是我在框架中单击一个键。
2014-07-31 14:13:28.281 java[52432:507] An uncaught exception was raised
2014-07-31 14:13:28.282 java[52432:507] java.lang.NullPointerException
2014-07-31 14:13:28.284 java[52432:507] (
0 CoreFoundation 0x00007fff8a62e25c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8baf3e75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8a62de09 -[NSException raise] + 9
3 JavaNativeFoundation 0x000000010ed0a457 JNFCallObjectMethod + 212
4 liblwawt.dylib 0x000000010f53b913 -[AWTView attributedSubstringForProposedRange:actualRange:] + 78
5 AppKit 0x00007fff8ad6c75d -[NSTextInputContext handleTSMEvent:] + 3476
6 AppKit 0x00007fff8ad6b9a5 _NSTSMEventHandler + 205
7 HIToolbox 0x00007fff88da81d4 _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 892
8 HIToolbox 0x00007fff88da7787 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 385
9 HIToolbox 0x00007fff88dbb880 SendEventToEventTarget + 40
10 HIToolbox 0x00007fff88dfcd0d SendTSMEvent + 33
11 HIToolbox 0x00007fff88faa5ff SendTextInputEvent + 1028
12 HIToolbox 0x00007fff88ff589c -[IMKInputSession _copyUniCharsForRange:intoBuffer:ofLength:] + 268
13 HIToolbox 0x00007fff88ff596b -[IMKInputSession _coreAttributesFromRange:whichAttributes:actualRange:] + 137
14 HIToolbox 0x00007fff88ff6a5c -[IMKInputSession attributedSubstringFromRange:] + 89
15 CoreFoundation 0x00007fff8a519bec __invoking___ + 140
16 CoreFoundation 0x00007fff8a519a54 -[NSInvocation invoke] + 308
17 CoreFoundation 0x00007fff8a5bc5e6 -[NSInvocation invokeWithTarget:] + 54
18 CoreFoundation 0x00007fff8a58c1c4 ___forwarding___ + 452
19 CoreFoundation 0x00007fff8a58bf78 _CF_forwarding_prep_0 + 120
20 CoreFoundation 0x00007fff8a519bec __invoking___ + 140
21 CoreFoundation 0x00007fff8a519a54 -[NSInvocation invoke] + 308
22 Foundation 0x00007fff88310d47 -[NSConnection dispatchInvocation:] + 135
23 Foundation 0x00007fff88310a0d -[NSConnection handleRequest:sequence:] + 1434
24 Foundation 0x00007fff882b7d50 -[NSConnection handlePortCoder:] + 652
25 Foundation 0x00007fff882b7688 -[NSConnection dispatchWithComponents:] + 50
26 Foundation 0x00007fff8829bf38 __NSFireMachPort + 257
27 CoreFoundation 0x00007fff8a55fb44 __CFMachPortPerform + 388
28 CoreFoundation 0x00007fff8a55f9a9 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
29 CoreFoundation 0x00007fff8a55f91e __CFRunLoopDoSource1 + 478
30 CoreFoundation 0x00007fff8a550a16 __CFRunLoopRun + 1830
31 CoreFoundation 0x00007fff8a5500b5 CFRunLoopRunSpecific + 309
32 Foundation 0x00007fff882b406e -[NSConnection sendInvocation:internal:] + 1965
33 CoreFoundation 0x00007fff8a58c1c4 ___forwarding___ + 452
34 CoreFoundation 0x00007fff8a58bf78 _CF_forwarding_prep_0 + 120
35 HIToolbox 0x00007fff88ff1b3d -[IMKInputSession handleEvent:] + 946
36 HIToolbox 0x00007fff88fb51d8 IMKInputSessionProcessEventRef + 45
37 HIToolbox 0x00007fff88fb4792 InputMethodInstanceProcessEventRef + 100
38 HIToolbox 0x00007fff88fa9d4f TSMEventToInputMethod + 131
39 HIToolbox 0x00007fff88dfc4a0 TSMKeyEvent + 301
40 HIToolbox 0x00007fff88de92b7 TSMProcessRawKeyEvent + 3807
41 AppKit 0x00007fff8ad6b1f0 -[NSTextInputContext handleEvent:] + 731
42 AppKit 0x00007fff8ad4aabd -[NSView interpretKeyEvents:] + 180
43 liblwawt.dylib 0x000000010f53a880 -[AWTView keyDown:] + 85
44 AppKit 0x00007fff8ad1765b -[NSWindow sendEvent:] + 1843
45 liblwawt.dylib 0x000000010f53e2f5 -[AWTWindow_Normal sendEvent:] + 86
46 AppKit 0x00007fff8acb8c42 -[NSApplication sendEvent:] + 3395
47 libosxapp.dylib 0x000000010f5d666f -[NSApplicationAWT sendEvent:] + 179
48 AppKit 0x00007fff8ab08b89 -[NSApplication run] + 646
49 libosxapp.dylib 0x000000010f5d6557 +[NSApplicationAWT runAWTLoopWithApp:] + 156
50 liblwawt.dylib 0x000000010f52eba9 -[AWTStarter starter:] + 873
51 Foundation 0x00007fff8829513e __NSThreadPerformPerform + 229
52 CoreFoundation 0x00007fff8a55f731 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
53 CoreFoundation 0x00007fff8a550ea2 __CFRunLoopDoSources0 + 242
54 CoreFoundation 0x00007fff8a55062f __CFRunLoopRun + 831
55 CoreFoundation 0x00007fff8a5500b5 CFRunLoopRunSpecific + 309
56 java 0x00000001065313b0 CreateExecutionEnvironment + 871
57 java 0x000000010652bb5c JLI_Launch + 1952
58 java 0x000000010653170d main + 101
59 java 0x000000010652b3b4 start + 52
60 ??? 0x0000000000000005 0x0 + 5
)
代码:
public class TestGame extends JFrame{
public static void main(String[] args){
new TestGame();
}
public TestGame(){
this.setSize(1024, 768);
this.setLocationRelativeTo(null);
this.setResizable(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
}
答案 0 :(得分:0)
我不会在Windows 8上使用Java 7或8。
也许以推荐的方式启动它:
public class TestGame {
public void launch() {
JFrame frame = new JFrame();
frame.setSize(1024, 768);
frame.setLocationRelativeTo(null);
frame.setResizable(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new TestGame().launch();
}
});
}
}
答案 1 :(得分:0)
我经历了同样的事情并且等待这个问题的答案很长一段时间。当我在OS X 10.9上使用Eclipse时发生此错误。我已将OS X升级到10.10,错误消失了!
答案 2 :(得分:0)
这似乎是mac os java上的一个错误。
我在netbeans上遇到了同样的错误。在10.9之后一切都很好,但在我更新10.10后出现了问题,这与@giripp的anwser相反。