interface A
{
int x=100;
void paint();}
class C implements A{
double x=200;
public void paint()
{System.out.println("抽象类练习"); }
}
class Example{
public static void main (String[] args) {
System.out.println(A.x); A b=new C();
b.paint();
System.out.println(b.x);
}
}一段简单的代码,我把他打包到Example.jar中,MANIFEST.MF文件修改如下:
Manifest-Version: 1.0
Created-By: 1.5.0_12 (Sun Microsystems Inc.)
Main-Class: Example有空格,也有回车,但是在运行java -jar Example.jar
提示:
Exception in thread "main" java.lang.NoClassDefFoundError: A请教各位怎么解决,是什么问题?
{
int x=100;
void paint();}
class C implements A{
double x=200;
public void paint()
{System.out.println("抽象类练习"); }
}
class Example{
public static void main (String[] args) {
System.out.println(A.x); A b=new C();
b.paint();
System.out.println(b.x);
}
}一段简单的代码,我把他打包到Example.jar中,MANIFEST.MF文件修改如下:
Manifest-Version: 1.0
Created-By: 1.5.0_12 (Sun Microsystems Inc.)
Main-Class: Example有空格,也有回车,但是在运行java -jar Example.jar
提示:
Exception in thread "main" java.lang.NoClassDefFoundError: A请教各位怎么解决,是什么问题?
jar uvfm Example.jar MANIFEST.MF A.class
public static void main (String[] args) {
System.out.println(A.x); A b=new C();
b.paint();
System.out.println(b.x);
}
}
http://blog.chinaunix.net/u/21684/showart_217219.html
(假设在运行的helloworld.jar在当前目录,驱动xxxDBDriver.jar在src/下) 1.在manifest.mf中加入:
Manifest-Version: 1.0
Class-Path: src/xxxDBDriver.jar
Main-Class: yin.test.HelloWorld 2.调用时使用:
java -cp .;./src;./src/xxxDBDriver.jar -jar helloworld.jar
see
http://topic.csdn.net/u/20071106/23/aa22470e-ebfb-4cd9-a856-c72a5cd6574c.html