步骤简介
- jar xvf 包文件名.jar
- 添加修改文件
- jar cvf 包文件名.jar
举个栗子
以abc.jar
为例
# 创建临时目录,解压包到临时目录
mkdir temp && cd temp && jar xvf ../abc.jar
# 添加一个文件 可以是任意文件。
echo 'helloword' > hello.txt
# 重新打包
cd .. && jar cvf abc.jar -C temp .
# 此时就把hello.txt添加到abc.jar中了
以abc.jar
为例
# 创建临时目录,解压包到临时目录
mkdir temp && cd temp && jar xvf ../abc.jar
# 添加一个文件 可以是任意文件。
echo 'helloword' > hello.txt
# 重新打包
cd .. && jar cvf abc.jar -C temp .
# 此时就把hello.txt添加到abc.jar中了