简体   繁体   中英

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?
Get files from Jar which is on the repository without downloading the whole Jar from Java

I, in an applet, would like to download classes from a Jar file inside the server, but without downloading the whole jar file. 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

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. Something like following:

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

The applet will call on above 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.

I think above should work for you.

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.

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