简体   繁体   中英

how to run the signed jar file in java command prompt?

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/*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM