java - Dynamic Jar loading is confusing me -
Conceptually, what am I doing to load a new jar? URLClassloader Is The Only Option? How do I make those URLs to point to a subdirectory with more jar?
If someone is feeling over-generous, then some display code will be helpful in performing the following tasks (let's say "jars / ezar" say "myClass" in which we want to instantiate):
Conceptually, what am I doing when I am loading a new jar
You have a new jar Do not load Sector Instead, you are defining a class loader will load code and other resources from JR file on demand.
Is URLClassloader the only option?
In theory, you can implement your subclass of ClassLoader
, but this is not necessary for what you are trying to do.
How do I create URLs that point to more jar subdirectories.
This is a small part of your problem which I think. The structure interprets the argument as url []
"any URL referenced to a directory that ends with '/' The URL is considered to be mentioned as a jar file which will open when downloaded and opened. "
In the first case of the quoted text above, the directory is considered To be the root of the tree with load resources
but I I am trying to install a class loader that will load from all the JAR files in a given directory. To do this, you must:
- Create the directory of the
file
object for any JAR files and create a list. - The array to keep the same number of
URLs
examples. - For each JAR file
file
, useFile.toURL ()
to create aURL
and the array means that you will get the "File:" URLs for JAR files that will work on your platform.) -
Create URLClassLoader using
URL
array
Comments
Post a Comment