I have a jar file, a.jar, which contains A.class and its manifest has Main-Class attribute set to A. A.class depends on B.class. B.class is packaged inside b.jar.
When I run 'java -classpath a.jar:b.jar A', it is able to find B.class.
When I run 'java -classpath b.jar -jar a.jar', it fails to find B.class as the following error shows:
Exception in thread "main" java.lang.NoClassDefFoundError: B
at A.main(A.java:3)
Both a.jar, b.jar and A.java & B.java are included in attachment testcase.zip.
I am using JDK 1.5. When I tested with 1.6.0-beta2-b72, I got the same result.
When I run 'java -classpath a.jar:b.jar A', it is able to find B.class.
When I run 'java -classpath b.jar -jar a.jar', it fails to find B.class as the following error shows:
Exception in thread "main" java.lang.NoClassDefFoundError: B
at A.main(A.java:3)
Both a.jar, b.jar and A.java & B.java are included in attachment testcase.zip.
I am using JDK 1.5. When I tested with 1.6.0-beta2-b72, I got the same result.
- duplicates
-
JDK-4459663 Using executable jars erases CLASSPATH
-
- Closed
-