How to load classes from jar file in-memory stream

2019-02-26 13:16发布

I'm building a Java application that has parts that require daily update. I want to download frequently updated parts as small jar file from my server to memory. I'm downloading the jar file as byte stream and not using URLClassloader.

  1. How can I make the classes in the jar file to be available to the system class loader from my custom class loader?

  2. How can I make sure that the download jar file and loaded classes are never cached or written to disk.

1条回答
Luminary・发光体
2楼-- · 2019-02-26 14:04

You can have a custom class loader load from memory. You can force the system loader, load specified classes from memory. However, you can't change the default system loader to read from memory on the fly.

查看更多
登录 后发表回答