I have created jar file in java 6 command prompt and then signed the jar file using jdk jarsigner utility.Finally it was verified successfully.But when i run the jar file using

Java -jar JarExample.jar

It throws exception like NoClassDefFoundError.Could not find the main class :JarTest

This is my manifest file content:

Manifest-Version: 1.0
Created-By: 1.6.0_20 (Sun Microsystems Inc.)
Main-Class: JarTest 

Name: ClassFile.class
SHA1-Digest: 6/tiYFkvtAy4Vl0ODl/6y6j/IJU=

Name: JarTest.class
SHA1-Digest: eDa/GNMKffutC3xfAyAwX0mCNnM=

But Before signing the jar it worked fine.So, I don't know what's wrong with this?

Please Guide me get out of this issue?

有帮助吗?

解决方案

I have seen your question.Maybe I know your problem is where ? the Manifest file must have a Class-Path variable,so in created jar file must have the information which I show you below:

Manifest-Version: 1.0
Created-By: 1.6.0_20 (Sun Microsystems Inc.)
Main-Class: JarTest 
Class-Path:./lib/yourName.jar ./lib/*
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top