미리 사과 - 많은, 많은, 많은 아주 많은 비슷한 질문이 있다는 것을 알고 있지만 내 상황에 특정한 것을 묻고 싶었습니다.NoClassDefFoundError 명령 줄에서 실행하려고 시도 할 때
동일한 디렉토리에 여러 개의 Java 및 jar 파일이 있습니다. 나는 잘 컴파일 할 수 있었고 결국 같은 디렉토리에 여러 개의 클래스 파일을 만들게되었다. 그러나 나는 그것이 지정된 클래스를 찾을 수 없다는 그것이 않는 NoClassDefFoundError를 제공하는 프로그램을 실행 갈 때 :
C:\Users\DB\Desktop\nextreports-integration-demo\src\ro\nextreports\integration>
java -cp ".;*.jar" SimpleDemo
Exception in thread "main" java.lang.NoClassDefFoundError: SimpleDemo (wrong nam
e: ro/nextreports/integration/SimpleDemo)
내가 더 높은 수준의 디렉토리에서 같은 일을 시도했지만 그것은 차이하지 :
C:\Users\DB\Desktop\nextreports-integration-demo\src>java -cp ".\ro\nextreports\
integration\*.jar;.\ro\nextreports\integration" SimpleDemo
Exception in thread "main" java.lang.NoClassDefFoundError: SimpleDemo (wrong nam
e: ro/nextreports/integration/SimpleDemo)
을
소스 파일의 패키지 문이다 : 나는 매우 초등학교 무언가를 내려다 해요 느낌이
package ro.nextreports.integration;
. 미리 감사드립니다.
편집 : 대단히 감사합니다.
java -cp ".\ro\nextreports\integration\nextreports-engine-6.3.jar;.\ro\nextreports\integration\commons-jexl-2.1.1.jar;.\ro\nextreports\integration\commons-logging-1.1.1.jar;.\ro\nextreports\integration\derby-10.10.1.1.jar;.\ro\nextreports\integration\itext-2.1.7.jar;.\ro\nextreports\integration\itext-rtf-2.1.7.jar;.\ro\nextreports\integration\itextpdf-5.0.6.jar;.\ro\nextreports\integration\jcalendar-1.3.2.jar;.\ro\nextreports\integration\jcommon-1.0.15.jar;.\ro\nextreports\integration\jfreechart-1.0.12.jar;.\ro\nextreports\integration\jofc2-1.0.1.jar;.\ro\nextreports\integration\mysql-connector-java-5.1.23-bin.jar;.\ro\nextreports\integration\mysql-connector-java-5.1.23-bin.jar;.\ro\nextreports\integration\poi-3.7.jar;.\ro\nextreports\integration\winstone-lite-0.9.10.jar;.\ro\nextreports\integration\xstream-1.3.1.jar;" ro.nextreports.integration.SimpleDemo
그런데 왜 나는 * .jar 파일에 대한 와일드 카드를 사용할 수 없습니다 : 그것은 다음과 같이 작동? 예를 들어, 어떤 jar 파일의 클래스에 대한 않는 NoClassDefFoundError에 다음 리드는 내가 명시 적으로하지 않습니다
java -cp ".;.\ro\nextreports\integration\*.jar" ro.nextreports.integration.
SimpleDemo
클래스의 정규화 된 이름을 사용해야합니다. 패키지 포함. –
경로 설정 및 classpath 변수가 환경 변수 설정에 설정되어 있는지 확인하십시오. – Sambhav