简体   繁体   English

如何将新的jar文件添加到服务器中现有的已部署jar

[英]How to add new jar file to existing deployed jar in server

I have a RMI application which is running on the server. 我有一个正在服务器上运行的RMI应用程序。 Now i want to add external jar file to an existing deployed jar. 现在,我想将外部jar文件添加到现有的已部署jar中。

Note: It is not web application. 注意:它不是Web应用程序。

For example, here i mention the jar directories 例如,在这里我提到了jar目录

MyApplication.jar MyApplication.jar

  • manifest.mf 清单文件
  • .classpath .classpath
  • classes
    • My java class files 我的Java类文件
  • lib LIB
    • test.jar test.jar
    • test1.jar test1.jar
  • images 图片
  • META-INF META-INF
    • MANIFEST.MF 清单文件

.classpath has .classpath有

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
  <classpathentry kind="src" path="src"/>
  <classpathentry kind="lib" path="lib/test.jar"/>
  <classpathentry kind="lib" path="lib/test1.jar"/>
  <classpathentry kind="output" path="classes"/>
</classpath> 

Now i want to add test2.jar to my lib folder inside MyApplication.jar and updating .classpath file. 现在我想将test2.jar添加到MyApplication.jar中的我的lib文件夹中并更新.classpath文件。

Is it possible to add it? 可以添加吗?

If you cannot use JRebel then you will probably have to try to write your own class loader to achieve this. 如果您不能使用JRebel,则可能必须尝试编写自己的类加载器以实现此目的。 There are many pitfalls. 有很多陷阱。 See this answer and this question for some pointers. 请参阅此答案此问题的一些指针。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM