我正在开发一个LeapMotion项目。 这是我的源代码:
import java.io.IOException;
import com.leapmotion.leap.Controller;
import com.leapmotion.leap.Listener;
public class Main {
public static void main(String[] args) {
Controller controller = new Controller();
controller.addListener(new Listener(){
@Override
public void onConnect(Controller arg0) {
super.onConnect(arg0);
System.out.print("\nOnConnect");
}
@Override
public void onDeviceChange(Controller arg0) {
super.onDeviceChange(arg0);
System.out.print("\nOnDeviceChanged");
}
@Override
public void onDisconnect(Controller arg0) {
super.onDisconnect(arg0);
System.out.print("\nOnDisconnected");
}
@Override
public void onExit(Controller arg0) {
super.onExit(arg0);
System.out.print("\nOnExit");
}
@Override
public void onFocusGained(Controller arg0) {
super.onFocusGained(arg0);
System.out.print("\nOnFocusGained");
}
@Override
public void onFocusLost(Controller arg0) {
super.onFocusLost(arg0);
System.out.print("\nOnFocusLost");
}
@Override
public void onFrame(Controller arg0) {
super.onFrame(arg0);
System.out.print("\nOnFrame");
}
@Override
public void onInit(Controller arg0) {
super.onInit(arg0);
System.out.print("\nOnInit");
}
@Override
public void onServiceConnect(Controller arg0) {
super.onServiceConnect(arg0);
System.out.print("\nOnServiceConnect");
}
@Override
public void onServiceDisconnect(Controller arg0) {
super.onServiceDisconnect(arg0);
System.out.print("\nOnServiceDisconnect");
}
});
System.out.print("\nKeep proccess until press a key");
try {
System.in.read();
} catch (IOException e) {
e.printStackTrace();
}
}
}
当我执行时,报告了胎儿错误:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x000000012696f957, pid=7742, tid=23043
#
# JRE version: Java(TM) SE Runtime Environment (8.0_05-b13) (build 1.8.0_05-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.5-b02 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C [libLeap.dylib+0x32957] Leap::InteractionBox::toCString() const+0x2c57
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash
这是日志文件的一部分:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x000000012696f957, pid=7742, tid=23043
#
# JRE version: Java(TM) SE Runtime Environment (8.0_05-b13) (build 1.8.0_05-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.5-b02 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C [libLeap.dylib+0x32957] Leap::InteractionBox::toCString() const+0x2c57
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
#
--------------- T H R E A D ---------------
Current thread is native thread
siginfo:si_signo=SIGSEGV: si_errno=0, si_code=0 (SEGV0), si_addr=0x0000000000000000
Registers:
RAX=0x9000000000000000, RBX=0x00007fcc9b536100, RCX=0x0000000000000000, RDX=0x00007fcc9b531648
RSP=0x0000000126f06da0, RBP=0x0000000126f06eb0, RSI=0x00005a0000005a00, RDI=0x0000590000005a03
R8 =0x0000000000000040, R9 =0x0000000126f06c00, R10=0x000000006785c292, R11=0x0000000019c91492
R12=0x0000000126f06df8, R13=0x00007fcc9b424e70, R14=0x0000000000000001, R15=0x00007fcc9b52fcb0
RIP=0x000000012696f957, EFLAGS=0x0000000000010202, ERR=0x0000000000000000
TRAPNO=0x000000000000000d
Top of Stack: (sp=0x0000000126f06da0)
0x0000000126f06da0: 00007fcc9c09e128 00007fcc9c09de40
0x0000000126f06db0: 00007fcc9c09de10 00007fcc9c09e168
0x0000000126f06dc0: 00007fcc9c09e0e8 0000000000000000
0x0000000126f06dd0: 00007fcc9c09e1a8 00007fcc9b424e40
0x0000000126f06de0: 00007fcc9c09dc00 0000000000000000
0x0000000126f06df0: 0000000000000000 0000000000000000
0x0000000126f06e00: 0000000000000000 00007fcc9b424e70
0x0000000126f06e10: 00007fcc9b424e70 00007fcc9b424e70
0x0000000126f06e20: 0000000000000001 0000000000000000
0x0000000126f06e30: 0000000000000000 00007fcc9b424e40
0x0000000126f06e40: 00007fcc9b424e40 00007fcc9b424e40
0x0000000126f06e50: 0000000000000001 00007fcc9c09de10
0x0000000126f06e60: 00007fcc9b532fb0 00007fcc9c09e168
0x0000000126f06e70: 0000000000000001 00007fcc9c09de40
0x0000000126f06e80: 00007fcc9b533330 00007fcc9b536640
0x0000000126f06e90: 0000000000005a03 00007fcc9b536970
0x0000000126f06ea0: 00007fcc9b536640 00000001269c4670
0x0000000126f06eb0: 0000000126f06ef0 00000001269c472a
0x0000000126f06ec0: 0000000000000000 0000000126f07000
0x0000000126f06ed0: 0000000000005a03 0000000000000000
0x0000000126f06ee0: 00007fcc9b536970 00000001269c4670
0x0000000126f06ef0: 0000000126f06f10 00007fff8a691899
0x0000000126f06f00: 0000000000005a03 0000000126f07000
0x0000000126f06f10: 0000000126f06f50 00007fff8a69172a
0x0000000126f06f20: 0000000000000000 0000000000000000
0x0000000126f06f30: 0000000000000000 0000000000000000
0x0000000126f06f40: 0000000000000000 0000000000000000
0x0000000126f06f50: 0000000126f06f78 00007fff8a695fc9
0x0000000126f06f60: 0000000000000000 0000000000000000
0x0000000126f06f70: 0000000000000000 0000000000000000
0x0000000126f06f80: 0000000000000000 0000000000000000
0x0000000126f06f90: 0000000000000000 0000000000000000
Instructions: (pc=0x000000012696f957)
0x000000012696f937: 40 38 48 89 df 4c 89 fe ff d0 eb 0c 48 8b 40 40
0x000000012696f947: 48 89 df 4c 89 fe ff d0 45 85 f6 74 0f 48 8b 03
0x000000012696f957: 48 8b 40 30 48 89 df 4c 89 fe ff d0 4c 89 ef e8
0x000000012696f967: 8d 02 0c 00 49 89 c5 e9 5d ff ff ff 48 89 c7 e8
Register to memory mapping:
RAX=0x9000000000000000 is an unknown value
RBX=0x00007fcc9b536100 is an unknown value
RCX=0x0000000000000000 is an unknown value
RDX=0x00007fcc9b531648 is an unknown value
RSP=0x0000000126f06da0 is an unknown value
RBP=0x0000000126f06eb0 is an unknown value
RSI=0x00005a0000005a00 is an unknown value
RDI=0x0000590000005a03 is an unknown value
R8 =0x0000000000000040 is an unknown value
R9 =0x0000000126f06c00 is an unknown value
R10=0x000000006785c292 is an unknown value
R11=0x0000000019c91492 is an unknown value
R12=0x0000000126f06df8 is an unknown value
R13=0x00007fcc9b424e70 is an unknown value
R14=0x0000000000000001 is an unknown value
R15=0x00007fcc9b52fcb0 is an unknown value
Stack: [0x0000000126e87000,0x0000000126f07000], sp=0x0000000126f06da0, free space=511k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libLeap.dylib+0x32957] Leap::InteractionBox::toCString() const+0x2c57
C [libLeap.dylib+0x8772a] Leap::Tool::toCString() const+0x3be9a
C [libsystem_pthread.dylib+0x1899] _pthread_body+0x8a
C [libsystem_pthread.dylib+0x172a] _pthread_struct_init+0x0
C [libsystem_pthread.dylib+0x5fc9] thread_start+0xd
--------------- P R O C E S S ---------------
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap:
PSYoungGen total 1536K, used 501K [0x0000000795580000, 0x0000000795980000, 0x00000007c0000000)
eden space 1024K, 2% used [0x0000000795580000,0x0000000795585468,0x0000000795680000)
from space 512K, 93% used [0x0000000795680000,0x00000007956f8020,0x0000000795700000)
to space 1024K, 0% used [0x0000000795880000,0x0000000795880000,0x0000000795980000)
ParOldGen total 129536K, used 531K [0x0000000740000000, 0x0000000747e80000, 0x0000000795580000)
object space 129536K, 0% used [0x0000000740000000,0x0000000740084f10,0x0000000747e80000)
Metaspace used 4332K, capacity 4700K, committed 4864K, reserved 1056768K
class space used 452K, capacity 460K, committed 512K, reserved 1048576K
Card table byte_map: [0x000000011f5c0000,0x000000011f9c1000] byte_map_base: 0x000000011bbc0000
Marking Bits: (ParMarkBitMap*) 0x000000010f07d0a0
Begin Bits: [0x000000011ff75000, 0x0000000121f75000)
End Bits: [0x0000000121f75000, 0x0000000123f75000)
Polling page: 0x000000010f81c000
CodeCache: size=245760Kb used=1392Kb max_used=1398Kb free=244367Kb
bounds [0x0000000110200000, 0x0000000110470000, 0x000000011f200000]
total_blobs=432 nmethods=150 adapters=198
compilation: enabled
Compilation events (10 events):
Event: 0.753 Thread 0x00007fcc9c809000 146 3 java.nio.ByteBuffer::arrayOffset (35 bytes)
Event: 0.754 Thread 0x00007fcc9c809000 nmethod 146 0x000000011035c910 code [0x000000011035caa0, 0x000000011035cd98]
Event: 0.780 Thread 0x00007fcc9c809000 147 3 java.nio.Buffer::position (43 bytes)
Event: 0.781 Thread 0x00007fcc9c809000 nmethod 147 0x000000011035c450 code [0x000000011035c5c0, 0x000000011035c868]
Event: 0.889 Thread 0x00007fcc9c809000 148 3 java.lang.ref.Reference::<init> (25 bytes)
Event: 0.889 Thread 0x00007fcc9c809000 nmethod 148 0x000000011035bfd0 code [0x000000011035c140, 0x000000011035c390]
Event: 0.943 Thread 0x00007fcc9c809000 149 3 java.nio.CharBuffer::arrayOffset (35 bytes)
Event: 0.943 Thread 0x00007fcc9c809000 nmethod 149 0x000000011035ba10 code [0x000000011035bba0, 0x000000011035be98]
Event: 1.731 Thread 0x00007fcc9c809000 150 3 sun.misc.VM::addFinalRefCount (24 bytes)
Event: 1.732 Thread 0x00007fcc9c809000 nmethod 150 0x000000011035b6d0 code [0x000000011035b820, 0x000000011035b9b0]
GC Heap History (10 events):
Event: 0.126 GC heap before
{Heap before GC invocations=1 (full 0):
PSYoungGen total 1024K, used 512K [0x0000000795580000, 0x0000000795700000, 0x00000007c0000000)
eden space 512K, 100% used [0x0000000795580000,0x0000000795600000,0x0000000795600000)
from space 512K, 0% used [0x0000000795680000,0x0000000795680000,0x0000000795700000)
to space 512K, 0% used [0x0000000795600000,0x0000000795600000,0x0000000795680000)
ParOldGen total 129536K, used 0K [0x0000000740000000, 0x0000000747e80000, 0x0000000795580000)
object space 129536K, 0% used [0x0000000740000000,0x0000000740000000,0x0000000747e80000)
Metaspace used 2486K, capacity 4480K, committed 4480K, reserved 1056768K
class space used 268K, capacity 384K, committed 384K, reserved 1048576K
Event: 0.128 GC heap after
Heap after GC invocations=1 (full 0):
PSYoungGen total 1024K, used 464K [0x0000000795580000, 0x0000000795700000, 0x00000007c0000000)
eden space 512K, 0% used [0x0000000795580000,0x0000000795580000,0x0000000795600000)
from space 512K, 90% used [0x0000000795600000,0x0000000795674010,0x0000000795680000)
to space 512K, 0% used [0x0000000795680000,0x0000000795680000,0x0000000795700000)
ParOldGen total 129536K, used 8K [0x0000000740000000, 0x0000000747e80000, 0x0000000795580000)
object space 129536K, 0% used [0x0000000740000000,0x0000000740002000,0x0000000747e80000)
Metaspace used 2486K, capacity 4480K, committed 4480K, reserved 1056768K
class space used 268K, capacity 384K, committed 384K, reserved 1048576K
}
Event: 0.152 GC heap before
{Heap before GC invocations=2 (full 0):
PSYoungGen total 1024K, used 975K [0x0000000795580000, 0x0000000795700000, 0x00000007c0000000)
eden space 512K, 99% used [0x0000000795580000,0x00000007955ffc60,0x0000000795600000)
from space 512K, 90% used [0x0000000795600000,0x0000000795674010,0x0000000795680000)
to space 512K, 0% used [0x0000000795680000,0x0000000795680000,0x0000000795700000)
ParOldGen total 129536K, used 8K [0x0000000740000000, 0x0000000747e80000, 0x0000000795580000)
object space 129536K, 0% used [0x0000000740000000,0x0000000740002000,0x0000000747e80000)
Metaspace used 2743K, capacity 4486K, committed 4864K, reserved 1056768K
class space used 299K, capacity 386K, committed 512K, reserved 1048576K
Event: 0.153 GC heap after
Heap after GC invocations=2 (full 0):
PSYoungGen total 1024K, used 496K [0x0000000795580000, 0x0000000795780000, 0x00000007c0000000)
eden space 512K, 0% used [0x0000000795580000,0x0000000795580000,0x0000000795600000)
from space 512K, 96% used [0x0000000795680000,0x00000007956fc010,0x0000000795700000)
to space 512K, 0% used [0x0000000795600000,0x0000000795600000,0x0000000795680000)
ParOldGen total 129536K, used 48K [0x0000000740000000, 0x0000000747e80000, 0x0000000795580000)
object space 129536K, 0% used [0x0000000740000000,0x000000074000c000,0x0000000747e80000)
Metaspace used 2743K, capacity 4486K, committed 4864K, reserved 1056768K
class space used 299K, capacity 386K, committed 512K, reserved 1048576K
}
Event: 0.181 GC heap before
{Heap before GC invocations=3 (full 0):
PSYoungGen total 1024K, used 1008K [0x0000000795580000, 0x0000000795780000, 0x00000007c0000000)
eden space 512K, 100% used [0x0000000795580000,0x0000000795600000,0x0000000795600000)
from space 512K, 96% used [0x0000000795680000,0x00000007956fc010,0x0000000795700000)
to space 512K, 0% used [0x0000000795600000,0x0000000795600000,0x0000000795680000)
ParOldGen total 129536K, used 48K [0x0000000740000000, 0x0000000747e80000, 0x0000000795580000)
object space 129536K, 0% used [0x0000000740000000,0x000000074000c000,0x0000000747e80000)
Metaspace used 3559K, capacity 4486K, committed 4864K, reserved 1056768K
class space used 375K, capacity 386K, committed 512K, reserved 1048576K
Event: 0.183 GC heap after
Heap after GC invocations=3 (full 0):
PSYoungGen total 1024K, used 512K [0x0000000795580000, 0x0000000795780000, 0x00000007c0000000)
eden space 512K, 0% used [0x0000000795580000,0x0000000795580000,0x0000000795600000)
from space 512K, 100% used [0x0000000795600000,0x0000000795680000,0x0000000795680000)
to space 512K, 0% used [0x0000000795700000,0x0000000795700000,0x0000000795780000)
ParOldGen total 129536K, used 348K [0x0000000740000000, 0x0000000747e80000, 0x0000000795580000)
object space 129536K, 0% used [0x0000000740000000,0x0000000740057130,0x0000000747e80000)
Metaspace used 3559K, capacity 4486K, committed 4864K, reserved 1056768K
class space used 375K, capacity 386K, committed 512K, reserved 1048576K
}
Event: 0.216 GC heap before
{Heap before GC invocations=4 (full 0):
PSYoungGen total 1024K, used 1009K [0x0000000795580000, 0x0000000795780000, 0x00000007c0000000)
eden space 512K, 97% used [0x0000000795580000,0x00000007955fc510,0x0000000795600000)
from space 512K, 100% used [0x0000000795600000,0x0000000795680000,0x0000000795680000)
to space 512K, 0% used [0x0000000795700000,0x0000000795700000,0x0000000795780000)
ParOldGen total 129536K, used 348K [0x0000000740000000, 0x0000000747e80000, 0x0000000795580000)
object space 129536K, 0% used [0x0000000740000000,0x0000000740057130,0x0000000747e80000)
Metaspace used 4241K, capacity 4636K, committed 4864K, reserved 1056768K
class space used 451K, capacity 460K, committed 512K, reserved 1048576K
Event: 0.217 GC heap after
Heap after GC invocations=4 (full 0):
PSYoungGen total 1536K, used 480K [0x0000000795580000, 0x0000000795780000, 0x00000007c0000000)
eden space 1024K, 0% used [0x0000000795580000,0x0000000795580000,0x0000000795680000)
from space 512K, 93% used [0x0000000795700000,0x0000000795778020,0x0000000795780000)
to space 512K, 0% used [0x0000000795680000,0x0000000795680000,0x0000000795700000)
ParOldGen total 129536K, used 484K [0x0000000740000000, 0x0000000747e80000, 0x0000000795580000)
object space 129536K, 0% used [0x0000000740000000,0x0000000740079130,0x0000000747e80000)
Metaspace used 4241K, capacity 4636K, committed 4864K, reserved 1056768K
class space used 451K, capacity 460K, committed 512K, reserved 1048576K
}
Event: 1.730 GC heap before
{Heap before GC invocations=5 (full 0):
PSYoungGen total 1536K, used 1504K [0x0000000795580000, 0x0000000795780000, 0x00000007c0000000)
eden space 1024K, 100% used [0x0000000795580000,0x0000000795680000,0x0000000795680000)
from space 512K, 93% used [0x0000000795700000,0x0000000795778020,0x0000000795780000)
to space 512K, 0% used [0x0000000795680000,0x0000000795680000,0x0000000795700000)
ParOldGen total 129536K, used 484K [0x0000000740000000, 0x0000000747e80000, 0x0000000795580000)
object space 129536K, 0% used [0x0000000740000000,0x0000000740079130,0x0000000747e80000)
Metaspace used 4331K, capacity 4700K, committed 4864K, reserved 1056768K
class space used 452K, capacity 460K, committed 512K, reserved 1048576K
Event: 1.731 GC heap after
Heap after GC invocations=5 (full 0):
PSYoungGen total 1536K, used 480K [0x0000000795580000, 0x0000000795980000, 0x00000007c0000000)
eden space 1024K, 0% used [0x0000000795580000,0x0000000795580000,0x0000000795680000)
from space 512K, 93% used [0x0000000795680000,0x00000007956f8020,0x0000000795700000)
to space 1024K, 0% used [0x0000000795880000,0x0000000795880000,0x0000000795980000)
ParOldGen total 129536K, used 531K [0x0000000740000000, 0x0000000747e80000, 0x0000000795580000)
object space 129536K, 0% used [0x0000000740000000,0x0000000740084f10,0x0000000747e80000)
Metaspace used 4331K, capacity 4700K, committed 4864K, reserved 1056768K
class space used 452K, capacity 460K, committed 512K, reserved 1048576K
}
Deoptimization events (0 events):
No events
Internal exceptions (10 events):
Event: 0.145 Thread 0x00007fcc9c001000 Exception <a 'java/security/PrivilegedActionException'> (0x00000007955dbc78) thrown at [/HUDSON/workspace/8-2-build-macosx-x86_64/jdk8u5/2488/hotspot/src/share/vm/prims/jvm.cpp, line 1248]
Event: 0.147 Thread 0x00007fcc9c001000 Exception <a 'java/util/zip/ZipException'> (0x00000007955e88e8) thrown at [/HUDSON/workspace/8-2-build-macosx-x86_64/jdk8u5/2488/hotspot/src/share/vm/prims/jni.cpp, line 716]
Event: 0.147 Thread 0x00007fcc9c001000 Exception <a 'java/security/PrivilegedActionException'> (0x00000007955eead8) thrown at [/HUDSON/workspace/8-2-build-macosx-x86_64/jdk8u5/2488/hotspot/src/share/vm/prims/jvm.cpp, line 1248]
Event: 0.147 Thread 0x00007fcc9c001000 Exception <a 'java/security/PrivilegedActionException'> (0x00000007955eec90) thrown at [/HUDSON/workspace/8-2-build-macosx-x86_64/jdk8u5/2488/hotspot/src/share/vm/prims/jvm.cpp, line 1248]
Event: 0.147 Thread 0x00007fcc9c001000 Exception <a 'java/security/PrivilegedActionException'> (0x00000007955ef000) thrown at [/HUDSON/workspace/8-2-build-macosx-x86_64/jdk8u5/2488/hotspot/src/share/vm/prims/jvm.cpp, line 1248]
Event: 0.150 Thread 0x00007fcc9c001000 Exception <a 'java/security/PrivilegedActionException'> (0x00000007955f5660) thrown at [/HUDSON/workspace/8-2-build-macosx-x86_64/jdk8u5/2488/hotspot/src/share/vm/prims/jvm.cpp, line 1248]
Event: 0.212 Thread 0x00007fcc9c001000 Exception <a 'java/security/PrivilegedActionException'> (0x00000007955ea2c8) thrown at [/HUDSON/workspace/8-2-build-macosx-x86_64/jdk8u5/2488/hotspot/src/share/vm/prims/jvm.cpp, line 1248]
Event: 0.213 Thread 0x00007fcc9c001000 Exception <a 'java/security/PrivilegedActionException'> (0x00000007955ed880) thrown at [/HUDSON/workspace/8-2-build-macosx-x86_64/jdk8u5/2488/hotspot/src/share/vm/prims/jvm.cpp, line 1248]
Event: 0.214 Thread 0x00007fcc9c001000 Exception <a 'java/security/PrivilegedActionException'> (0x00000007955f47e0) thrown at [/HUDSON/workspace/8-2-build-macosx-x86_64/jdk8u5/2488/hotspot/src/share/vm/prims/jvm.cpp, line 1248]
Event: 0.215 Thread 0x00007fcc9c001000 Exception <a 'java/security/PrivilegedActionException'> (0x00000007955f9180) thrown at [/HUDSON/workspace/8-2-build-macosx-x86_64/jdk8u5/2488/hotspot/src/share/vm/prims/jvm.cpp, line 1248]
Events (10 events):
Event: 1.702 Thread 0x00007fcc9c0a3000 Thread added: 0x00007fcc9c0a3000
Event: 1.702 Thread 0x00007fcc9c0a3000 Thread exited: 0x00007fcc9c0a3000
Event: 1.711 Thread 0x00007fcc9b8be000 Thread added: 0x00007fcc9b8be000
Event: 1.711 Thread 0x00007fcc9b8be000 Thread exited: 0x00007fcc9b8be000
Event: 1.720 Thread 0x00007fcc9d144800 Thread added: 0x00007fcc9d144800
Event: 1.720 Thread 0x00007fcc9d144800 Thread exited: 0x00007fcc9d144800
Event: 1.730 Thread 0x00007fcc9b8be000 Thread added: 0x00007fcc9b8be000
Event: 1.730 Executing VM operation: ParallelGCFailedAllocation
Event: 1.731 Executing VM operation: ParallelGCFailedAllocation done
Event: 1.731 Thread 0x00007fcc9b8be000 Thread exited: 0x00007fcc9b8be000
......
--------------- S Y S T E M ---------------
OS:Bsduname:Darwin 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
rlimit: STACK 8192k, CORE 0k, NPROC 709, NOFILE 10240, AS infinity
load average:1.47 1.53 1.80
CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 69 stepping 1, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, ht, tsc, tscinvbit
Memory: 4k page, physical 8388608k(2725724k free)
/proc/meminfo:
vm_info: Java HotSpot(TM) 64-Bit Server VM (25.5-b02) for bsd-amd64 JRE (1.8.0_05-b13), built on Mar 18 2014 00:36:13 by "java_re" with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
time: Mon Nov 10 22:11:50 2014
elapsed time: 1 seconds
我调查了一些数据:
http://www.oschina.net/question/1092_24066
但它看起来对我没用, 有人可以帮个忙吗?
答案 0 :(得分:1)
您的匿名侦听器对象正在被垃圾收集,因为您没有保留对它的引用。尝试:
import java.io.IOException;
import com.leapmotion.leap.Controller;
import com.leapmotion.leap.Listener;
public class Main {
public static void main(String[] args) {
Controller controller = new Controller();
Listener listen = new Listener(){
@Override
public void onConnect(Controller arg0) {
super.onConnect(arg0);
System.out.print("\nOnConnect");
}
@Override
public void onDeviceChange(Controller arg0) {
super.onDeviceChange(arg0);
System.out.print("\nOnDeviceChanged");
}
@Override
public void onDisconnect(Controller arg0) {
super.onDisconnect(arg0);
System.out.print("\nOnDisconnected");
}
@Override
public void onExit(Controller arg0) {
super.onExit(arg0);
System.out.print("\nOnExit");
}
@Override
public void onFocusGained(Controller arg0) {
super.onFocusGained(arg0);
System.out.print("\nOnFocusGained");
}
@Override
public void onFocusLost(Controller arg0) {
super.onFocusLost(arg0);
System.out.print("\nOnFocusLost");
}
@Override
public void onFrame(Controller arg0) {
super.onFrame(arg0);
System.out.print("\nOnFrame");
}
@Override
public void onInit(Controller arg0) {
super.onInit(arg0);
System.out.print("\nOnInit");
}
@Override
public void onServiceConnect(Controller arg0) {
super.onServiceConnect(arg0);
System.out.print("\nOnServiceConnect");
}
@Override
public void onServiceDisconnect(Controller arg0) {
//super.onServiceDisconnect(arg0);
System.out.print("\nOnServiceDisconnect");
}
};
controller.addListener(listen);
System.out.print("\nKeep proccess until press a key");
try {
System.in.read();
} catch (IOException e) {
e.printStackTrace();
}
}
}
或者,或许更好,从中创建一个合适的类。
(另外,没有理由在回调函数中调用super。)