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
0
votes
0 answers
URLClassLoader problems
I have a folder full of classes on which I want to load.
My URLClassLoader seems to load every other class just fine, but sometimes it misbehaves for some reason and it is driving me nuts. All the classes listed in the folder are basically empty…
user6628028
0
votes
2 answers
Got NoClassDefFoundError: wrong name with Windows path
I have a TEST123.class in the path below.
D:/Users/XXX/Desktop/sem-material-job/sem-material-job/sem-material-freemarkerjob/target/classes/com/ctrip/market/sem/freemarkerjob/dynamicjava/
Then I run the try clause below to load the class by…

Jason
- 1,115
- 14
- 25
0
votes
1 answer
Performance with URLCLassLoader with jar files
I have implemented a plugin infrastructure where I have:
a> war file : This war file has the class which loads the jar file dynamically from file system.
b> Jar file: These are placed in a file system which will be consumed by the war file above.…

Juniad Ahmed
- 155
- 3
- 14
0
votes
2 answers
Why this URLClassLoader sometimes works and sometimes doesn't?
I have a quite complex Java software that must load dynamically a class, create an object and invoke one of its methods. It turns out that in some situations this raises a NoClassDefFoundError (caused by a ClassNotFoundException) if the loaded class…

Pietro Braione
- 1,123
- 8
- 22
0
votes
2 answers
URLClassLoader can't handle jar:file urls?
I want to load a library in separated classloader because don't want to add directly as dependency to do not conflict with other versions in the project.
I created a loader:
public LibLoader(String resourcePath) {
…

Daniel Hári
- 7,254
- 5
- 39
- 54
0
votes
2 answers
Class Loading to an interface
I'm quite restricted in the platform I'm currently working on (JDK 1.3, BD-J). One JAR file I would like to use attempts to perform a self-integrity check on load and if it fails it goes into an inoperable state. It's quite difficult to find out why…

dekz
- 805
- 1
- 8
- 17
0
votes
1 answer
Loading external class files without regard to class-paths or packages
I am attempting to load a class object from some compiled class file sitting in my Desktop dir.
I am feeding in two arguments to main in my program which uses URLClassLoader to get an instance of a class from a compiled file TheClassToLoad.class.
I…

Alex Bollbach
- 4,370
- 9
- 32
- 80
0
votes
1 answer
Change packaging from "/" to "."
Okay, so I'm currently scanning a folder /Scripts/ for folders, and checking those folders for .class's
The problem is when I go to load the classes in classloader, I get a error with the packaging. It is not replacing the "/" with "." like it…

Ethan Brookman
- 97
- 1
- 9
0
votes
1 answer
Java Classloader not loading xml file
I am facing an issue where the class loader is unable to load an xml file that is in the classpath.
Below code first prints the files that are present in the classpath. Next it is supposed to print the location of the specific xml file that I want…

Sreeram V
- 3
- 4
0
votes
1 answer
Parent-Child Classloader Class Resolution
The tasks and initial investigation
I try to set up two Oracle Coherence near cache instances at one java swing application. The idea a solution could be found here. My case is a bit more complicated and this is where the game starts.
Short…

Dmitry
- 3,028
- 6
- 44
- 66
0
votes
1 answer
ClassLoader: pretend that a class wasn't found so a child loader can handle it instead
I want to make a subclass of URLClassLoader which, when loadClass() is invoked, can examine the loaded class with reflection and conditionally decide to pretend it couldn't find that class, so as to allow for a child class loader to handle the…

Matthew Cline
- 2,312
- 1
- 19
- 36
0
votes
1 answer
How to load .class and call one of its methods
I've compiled at runtime a java file on file system which is a very simple class:
public class Test {
public static int res(int a, int b) {
return a*b;
}
}
now I just want to call res method from my project (that will be a jar), but my…

Noomak
- 371
- 5
- 19
0
votes
1 answer
java static initializer called twice
static boolean isClassLoaded(String fullname) {
try {
Class.forName(fullname, false, Loader.instance().getModClassLoader());
return true;
} catch (Exception e) {
return false;
}
}
does this method has potential…

MCdevelopers
- 41
- 4
0
votes
1 answer
Find a java class that extends an abstract class
How would I find a class that extends another abstract class?
Currently I have this:
public PluginFinder(ClassLoader cl, File f) throws MalformedURLException, ClassNotFoundException {
super(new URL[]{f.toURI().toURL()}, cl);
Class>…

Community
- 143
- 2
- 10
0
votes
3 answers
instantiate a dynamically loaded class implementing an existing interface
I've seen a couple answers to similar questions but unfortunately none have been able to answer mine.
I have a web application that offers a computation platform and in order to extend it I have written an interface, so that the application would…

Abel
- 150
- 1
- 9