This class loader is used to load classes and resources from a search path of URLs referring to both JAR files and directories.
Questions tagged [urlclassloader]
286 questions
3
votes
3 answers
Java is there a way to load a class that has been already loaded by the System ClassLoader by a different one?
(Terrible Title, I know)
The best way to explain this, is that I need to load some classes that will be loaded at Runtime from a URLClassLoader, by these classes have references to instances of classes that are already loaded by the System…

Josh
- 83
- 10
3
votes
2 answers
Signed applet loads signed jar-files using URLClassLoader with security issue
I have a signed applet. To implement some plugin architecture I download and store to disk a JAR file with specific classes.
Then I load these classes with URLCLassLoader. So, now I try to invoke some method from loaded class and I have a security…

Nikolay Antipov
- 920
- 2
- 8
- 17
3
votes
1 answer
Issues with making plugin loader for a java app
I am trying to make a plugin system for an app I'm working on, what I want is to have a directory that can be filled with plugin jar files that is then loaded into the project when it starts. I have made the plugin structure dependency and have test…

Huon Swales
- 51
- 6
3
votes
3 answers
Custom URLClassLoader, NoClassDefFoundError when run
I've created my own URLClassLoader, and set it as the system classloader via java.system.class.loader. It's initialized and everything, but the classes I'm trying to load aren't found. Here's the URLClassLoader:
public class LibraryLoader extends…

Jonah
- 9,991
- 5
- 45
- 79
3
votes
1 answer
ClassNotFoundException issued by URLClassLoader when the Security Manager is enabled
For an experimental project, I am trying to load a class with URLClassLoader with the security manager enabled. Despite the fact that the URL and that the class do exist, the code always fails with a ClassNotFoundException.
This behaviour has been…

Corentor
- 661
- 1
- 6
- 11
3
votes
1 answer
URLClassLoader - Difference between getResource and findResource
The URLClassLoader has two functions for getting a resource as an URL. One is named getResource and is inherited, and one is from the URLClassLoader and it is named findResource. Both returns an URL. They look very similar, what is the difference…

jhertz
- 640
- 2
- 6
- 16
3
votes
1 answer
Java ClassLoader - force reloading already loaded classes
I'm currently trying to load classes into my application so that I can then filter out those that don't contain any test / @Test-methods. I want to run these tests in my application afterwards.
So far, so good - except it seems like the…

PixelMaster
- 895
- 10
- 28
3
votes
1 answer
Java 9 Classpath and Library Path Extension
Java 9 is modularized precluding accessing via reflection base Java components. This renders most methods of extending classpath and java.library.path programmatically invalid. How to do it right? And how to make it compatible with…

user579013
- 197
- 2
- 9
3
votes
1 answer
Is it possible to load library at runtime?
Is there a way to load a java library (.jar file) at runtime, if it is not on the classpath?

Rogach
- 26,050
- 21
- 93
- 172
3
votes
2 answers
Can't find Class with Class.forName() but it exists
I have a program in which I am generating classes at runtime (included only variable and associated getters and setters methods). Later I want to fill the classes.
To get the class - I know its Name, but its not in the classpath - I tried .forName()…

Lasirana
- 51
- 1
- 1
- 5
3
votes
3 answers
dalvik.system.PathClassLoader cannot be cast to java.net.URLClassLoader
Android - Adding jar file dynamically to a ClassLoader like:
String strJarfile = "/data/data/com.example.classloader/files/apps/Calc/SumAndSub.jar";
URLClassLoader sysloader = (URLClassLoader) ClassLoader
…

Tuan Huynh
- 566
- 4
- 13
3
votes
2 answers
ClassNotFoundException while loading a class from file with URLClassLoader
I am using the following code to create an instance of OdbcIniTarget class which implements the Target interface. The OdbcIniTarget class already exists in the application but is located in a different package and now should be loaded from the…

Tony Stark
- 2,318
- 1
- 22
- 41
3
votes
2 answers
Though my class was loaded, Class.forName throws ClassNotFoundException
The code is as follows
what it does is it loads all the classes inside a jar file which I placed inside my home directory .
import java.io.File;
import java.util.jar.JarFile;
import java.util.jar.JarEntry;
import java.net.URLClassLoader;
import…

Harish Kayarohanam
- 3,886
- 4
- 31
- 55
3
votes
1 answer
Detect Java JAR/Code Tampering
I'm writing a piece of software that is distributed as a JAR file. Currently, this JAR file can be tampered with to retrieve and save another file that our server transmits via URLClassLoader, be decompiled, and find various things in our code that…

Clay Freeman
- 533
- 5
- 17
3
votes
2 answers
Loading a custom class from arbitrary location
I am having some issues with Class Loading in Java. Inside my project I am trying to dynamically load a class from anywhere. However, I am currently failing at loading a hard-coded one and am still clueless after 6 hours of googling and…

user1922672
- 33
- 3