Java Virtual Machine Launcher Error: Invalid or Corrupt Jar file

12,402

Solution 1

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

Solution 2

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.

TO VERIFY:

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"
Share:
12,402
Usman Ali
Author by

Usman Ali

Updated on June 04, 2022

Comments

  • Usman Ali
    Usman Ali almost 2 years

    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.

    enter image description here

    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"

    enter image description here

    Plz Help me.

    Thanks.