How do you recompile a jar file?

后端 未结 4 1095
你的背包
你的背包 2021-01-01 00:28

I took an old jar file and edited it. Now i have a folder that has all the files and I want to recompile them back to a jar file. How do i do this?

4条回答
  •  醉酒成梦
    2021-01-01 01:20

    How did you edit it?

    Anyway, jar files follow the same format as regular zip files. If you want to update the content of the jar ( probably with a new file ) you could do:

    jar -uf yourJar.jar  path/to/updated/Class.class 
    

    That would update your jar with the file path/to/updated/Class.class If there's already a class with that name in that path, it would be replaced. If is not it would be created.

    After this your jar is up to date.

提交回复
热议问题