问题描述
- 新手jar包问题!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
制作了一个jar包,编写一个D.java调用jar包,编译没出错,运行出错,javac和java版本也相同,求解!
C:>set classpath
classpath=C:UsersAdministrator1T.jarC:>javac D.java
C:>java D
Exception in thread "main" java.lang.NoClassDefFoundError: D
Caused by: java.lang.ClassNotFoundException: D
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:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: D. Program will exit.D.java代码
import H.A;public class D
{
public static void main(String[] args)
{
A aa = new A();
aa.g();
}
}
jar包原文件:
A.java代码
package H;public class A
{
public void g()
{
System.out.printf("UUUU
");
}
}
class M
{
public static void main(String[] args)
{
System.out.printf("HHHH
");
}
}B.java代码
package U;
import H.*;class C extends A
{
public void f()
{
g();
}
}public class B
{
public static void main(String[] args)
{
C cc = new C();
cc.f();
}
}
解决方案
Groovy引用Jar包冲突问题
weblogic 服务器找不到某jar包方法问题
解决方案二:
http://www.cnblogs.com/yejiurui/archive/2012/12/25/2831736.html
解决方案三:
http://www.cnblogs.com/yejiurui/archive/2012/12/25/2831736.html