I try to run a jar file with my Raspberry Pi which has Raspbian OS. First I followed these instructions


from that page I run ;

apt-get install default-jre


apt-get install default-jdk

After succesful operations I try to open a jar file (which is succesfully opened in my Windows OS computer) with this from terminal;

sudo java -jar myJarFile.jar

it is not opened and gives and error like

Invalid or corrupt jarfile myJarFile.jar

So, what is the problem. Thanks for the help.

  • Not sure if this is that much raspberry pi based.
    – Loko
    Commented Jan 21, 2014 at 13:52
  • yes it is. I updated my answer.
    – mft
    Commented Jan 21, 2014 at 13:56
  • Yeah I know you are running it on raspbian and are using the raspberry pi but I mean that the problem may not have anything to do with the raspbery pi. Maybe it's something with Linux in general?
    – Loko
    Commented Jan 21, 2014 at 14:02
  • Have you tried recreating it from source on the pi to see what happens? If you don't have the source, where is the .jar from?
    – goldilocks
    Commented Jan 21, 2014 at 14:07
  • No. Just found a runnable .jar file and try to run.
    – mft
    Commented Jan 21, 2014 at 14:15

1 Answer 1


From what you say, it sounds like your jar file is corrupt. Maybe it got corrupted on download, or when copying it. Maybe you opened the jar, edited a file and then reconstructed the jar. Maybe you just zipped up the .class files and renamed it to jar.

My guess is that on your windows machine it's working but you're not running the same jar, or not running a jar at all. You say you "wrote a simple code with java", but also that you "Just found a runnable .jar file". You're not clear.

Copy the .class files to the pi and run those instead, or make a proper jar file and make sure you test the jar file thoroughly on your windows machine before transferring to the pi. If it works on one it should work on the other.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.