如何将新的java类添加到jar文件中的现有类中 [英] How to add new java classes to the existing classes in jar file

查看:931
本文介绍了如何将新的java类添加到jar文件中的现有类中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为用java编写的软件创建了新模块。该软件从jar文件运行。我的类正在扩展该软件中的类。我想写一个插件,它将新类添加到jar文件中。我知道如何将jar文件解压缩到目录并使用java.util.jar包将它们添加到jar文件中,但是因为要从文件中提取很多文件,是否可以在不提取文件的情况下添加新类以某种方式直接到文件夹。

I created new modules for software written in java. This software is run from jar file.My classes are extending the classes in this software. I want to write a plugin which adds new classes to the jar file. I know how to extract a jar file to the directory and add them to the jar file using java.util.jar package but as there are a lot of files to extract from the file, is it possible to add new classes without extracting the files to the folder, somehow directly.

推荐答案

您可以使用以下命令

jar uf foo.jar foo.class

这篇关于如何将新的java类添加到jar文件中的现有类中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆