如何正确修补 JAR 文件中的 Java 类?

发布于 2024-12-28 14:07:00 字数 391 浏览 1 评论 0原文

我需要修补 JA 文件中的一个类,该文件位于格式为 pack1.pack2.pack3.com 的包中。所以类的全名是:

pack1.pack2.pack3.com.classtopatch

我的应用程序中有一个文件夹:

c:/app/patches

我应该简单地将类复制到 c:/app/patches/classtopath.class 文件还是我 需要创建整个文件夹树,例如:

c:/app/patches/pack1/pack2/pack3/com 

并在 pack1/pack2/pack3/com 中放置 classtopath.clas ? 谢谢。

I need to patch a class that is in a JA file, in a package following the form pack1.pack2.pack3.com. So the full name of class is:

pack1.pack2.pack3.com.classtopatch

I have a folder in my application:

c:/app/patches

Should I simply copy the class to c:/app/patches/classtopath.class file or do I
need to create the entire folder tree like:

c:/app/patches/pack1/pack2/pack3/com 

and in pack1/pack2/pack3/com put classtopath.clas ?
Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

顾冷 2025-01-04 14:07:00

是的,您需要创建目录结构以匹配您的包名称。

创建c:/app/patches/pack1/pack2/pack3/com并将classtopath.class放入其中。

Yes, you need to create the directory structure to match your package name.

Create c:/app/patches/pack1/pack2/pack3/com and put classtopath.class in it.

与他有关 2025-01-04 14:07:00

您的问题不太清楚,但如果文件系统上有类文件,那么它们应该位于适当的包结构中。

如果将其打包到 jar 文件中,则 jar 文件本身可以位于任何位置,但包结构应该存在于 jar 文件中。

Your question isn't really clear, but if you've got class files on the file system, then they should be in the appropriate package structure.

If you're packing it into a jar file then the jar file itself can be anywhere, but the package structure should be present in the jar file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文