1

Cytoscape Simple App을 만들고 싶습니다 (플러그인 프로그램과 같습니다).ClassNotFoundException & NoClassDefFoundError (이유는 무엇입니까?)

그래서 .jar 파일을 만들어 Cytoscape 프로그램에 설치해야합니다.

내 문제는 다음과 같습니다.

두 가지 사례를 보여 드리겠습니다.

There are 6 classes(A,B,C,D,E,F), and 2 .jar file(that represent other API)

A (CytoscapeLeapMotionApp) is the main class(actually it doesn't include main method, but it is the first class run when App is installed).

C,E are classes that I made.

B,D are in 1.jar.

F(Listener) is in 2.jar(leap).

  • 사례 1

    A는

    C 인스턴스가

    C로 만든 B 연장 D 연장

    E 인스턴스 C

    에서 만들어 전자 연장 F는

는 결과 :

Caused by: java.lang.NoClassDefFoundError: com/leapmotion/leap/Listener  at 
CytoscapeLeapMotionApp.<init>(CytoscapeLeapMotionApp.java:9) ... 21 
more 

Caused by: java.lang.ClassNotFoundException: 
com.leapmotion.leap.Listener at 
java.net.URLClassLoader$1.run(URLClassLoader.java:202) at 
java.security.AccessController.doPrivileged(Native Method) at 
java.net.URLClassLoader.findClass(URLClassLoader.java:190) at 
java.lang.ClassLoader.loadClass(ClassLoader.java:306) at 
java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 22 more 
  • 케이스 A는

    C 인스턴스가

    C로 만든 B에게 확장 2

    는 D

    ,174,515 확장

    F 인스턴스는 C

에서 만든 결과 :

좋은, 오류없이!

다음은 E는 F

public final class SampleListener extends Listener { 
    //nothing 
} 
+0

리스너 – ray

+0

의 네임 스페이스로 전체 클래스 이름을 지정해보십시오. 어떻게 응용 프로그램을 실행하고 있습니까? IDE 내에서 또는 명령 줄을 통해? – JamesB

+0

@ray 죄송합니다. 초보자인데, 네임 스페이스가 무엇을 의미하는지 모르겠습니다. : –

답변

0

Caused by: java.lang.NoClassDefFoundError: com/leapmotion/leap/Listener at CytoscapeLeapMotionApp.(CytoscapeLeapMotionApp.java:9) ... 21 more

이 CytoscapeLeapMotionApp가 실행될 때, 유형 com.leapmotion.leap.Listener 클래스 경로에없는 것을 제안이 오류를 확장합니다.

이 유형이 2.jar 인 jar 파일에 있음을 나타내므로 재 시도하기 전에 클래스 경로에이 파일을 추가해야합니다.

+0

하지만 케이스 2를 시도 할 때 클래스 F (즉, 2.jar)도 사용합니다. 그러나 오류는 없습니다. 왜 이런 일이 일어날 지 모르겠다. –

+0

@ 대성기 어떻게 두 경우 모두 운영하고 있습니까? – JamesB

관련 문제