I want to update a .class file in a jar. The .class file is in a folder in the jar. If I want to update it, do I need to specify the specific pathname where it's located?
Do I do:
jar uf myJar.jar myFolder/myClass.class
or just:
jar uf myJar.jar myClass.class
If I don't specify path, will it automatically find the .class and replace it? Or are jars allowed to have the same .class names within different directories?
You need to be explicit. It's perfectly valid to have different classes with the same name in different packages. eg
com.example.package.A
com.example.package.subpackage.A
etc...
You need to provide the full path name to update the jar file
jar uf myJar.jar myFolder/myClass.class
And you can have same class files in different directories
jar uf jar-file input - >因为你想要更新已经存在的文件,你必须指定文件夹结构。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.