Invalid or corrupt jar file on Ubuntu Server

9,975

The jar file itself may have been corrupted on Windows (maybe by compressing it) before it was uploaded to Ubuntu Server on the VPS. To test for this possibility, check if the original jar file executes properly from Windows.

Share:
9,975

Related videos on Youtube

TreeHouseFalcon
Author by

TreeHouseFalcon

Updated on September 18, 2022

Comments

  • TreeHouseFalcon
    TreeHouseFalcon over 1 year

    I just got an Ubuntu VPS from ovh.ca the other day for hosting Java programs/web services on. I use Putty to interact with the VPS. I used PSCP via Windows Command Prompt to transfer my jar file onto the VPS into the /home directory successfully (When I type ls, it shows up). Everything is working except for when I try to run the jar file. It gives me this:

    Error: Invalid or corrupt jarfile gdbotproservlet.jar
    

    I have little experience with Ubuntu/Linux servers so I'm not sure if I just need to recompile on the server, because I tried it on my friend's OVH Ubuntu server and the same thing happened. I have a Windows computer and I've tested the program and it runs fine. And I exported it as a "Runnable Jar File" with Eclipse as well as added my own MANIFEST.MF file to the src package. What should I do to fix this?

    This is what it looks like:

    enter image description here

    And this is what the structure of the jar file looks like in Eclipse:

    enter image description here

    Also, I tried running the jar file on my Ubuntu server with -cp and it couldn't find the "MainServlet.java" class which has the main(String[] args) method in it.

  • TreeHouseFalcon
    TreeHouseFalcon almost 8 years
    That's weird, I ran it before and I thought it worked fine, I guess it didn't. Well thanks for that, I'll double check next time. It works!