简体   繁体   English

从jar的另一台机器上加载类,而无需下载整个Jar

[英]Load a class from a jar, in another machine, without downloading the whole Jar

I have seen two questions with same subject, but none of them seem to answer my question. 我已经看到两个主题相同的问题,但是似乎没有一个回答我的问题。 How to load a jar from an URL without downloading it? 如何从URL加载jar而不下载它?
Get files from Jar which is on the repository without downloading the whole Jar from Java 从存储库中的Jar获取文件,而无需从Java下载整个Jar

I, in an applet, would like to download classes from a Jar file inside the server, but without downloading the whole jar file. 我想在applet中从服务器内部的Jar文件中下载类,但不下载整个jar文件。 Is it possible? 可能吗?

in an applet, would like to download classes from a Jar file inside the server, but without downloading the whole jar file 在applet中,想从服务器内部的Jar文件中下载类,但不下载整个jar文件

If you have control over server code, write a servlet and then call the servlet with appropriate query to pull the required class in the jar. 如果您可以控制服务器代码,请编写一个servlet,然后使用适当的查询调用该servlet,以将所需的类放入jar中。 Something like following: 如下所示:

http://myserver.com/myservlet?download_class=x.y.z.class&jar_file=my.jar

The applet will call on above URL. 小程序将在上述URL上调用。 At the server, your servlet will pick the jar file and extract the required class and then send it across (using ServletOutputStream ) to to the applet. 在服务器上,您的servlet将选择jar文件并提取所需的类,然后通过ServletOutputStream将其发送到小程序。

I think above should work for you. 我认为以上应该为您工作。

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

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