Java Virtual Machine Launcher Error: Invalid or Corrupt Jar file
I am creating a jar file using netbeans. Then I create exe of this jar file using lanch4j. When I run this exe file on my computer it's run fine But When I run this exe on some other computer it gives me warning
The publisher could not be verified. Are you want to run this software
When click on Run the exe file runs fine.
I remove that warning by adding certificate to my exe file using signtool.exe which comes with windows sdk. and it successfully added certificate to my exe file.
But now when I run my exe file it gives me error
"Java Virtual Machine Launcher Error: Invalid or Corrupt Jar file"
Plz Help me.
This warning gets thrown because your application has not been signed. You didn't see the error on your local machine because you never transmitted the application. You saw it on some other machine presumably because you uploaded it somewhere then downloaded it to the other machine.
Checkout this other question for more info: Signing a Windows EXE file
EXE SIGNER FOR JAR WRAPPED INSIDE A EXE USING LAUNCH4J:
1.CERTIFICATION CREATION IS SAME AS NORMAL EXE SIGNER.
makecert -r -pe -ss MyCertStore -n "CN=MyTestCert" MyTestCert.cer
(NOTE:Import this certificate to Trusted certificate part in certmgr.msc in windows.)
Then only It won’t show unknown publisher at local system.
In windows ,Just type certmgr.msc in start window search box, certmgr.msc will prompt on screen, open that and then check whether certificate is successfully imported in Trusted certificate part.)
2.SIGN IN EXE USING SIGNTOOL AND SIGN4J:
sign4j signtool sign /s MyCertStore /n MyTestCert "sample.exe"
use sign4j to verify launch4j exe.. It avoid jar corruption..
sign4j signtool sign /s MyCertStore /n My_cert sample.exe
verify this link.. It will help you.. Sign a launch4j executable in ant with sign4j and jsign