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
2
votes
1 answer
Cunning classloader solution/hack needed for making child CL JMS interfaces available in parent CL
I'm writing a multi-vendor JMS adapter, and some silly licensing issues have thrown up the need for a cunning classloader solution/hack - it isn't going to be pretty, but I'd love to hear some ingenious ideas from expert classloader hackers out…

Ben Spiller
- 477
- 4
- 12
2
votes
1 answer
Java dynamic class loading fails on windows, but working fine on linux
I am trying to load a class dynamically from a jar file. It worked fine on a Ubuntu linux box ( Sun Java Version 1.6.0_24 (b07).
When I tried to run the same thing on Windows (Windows 7, Java version "1.6.0_14") it fails with Class Not Found…

Abhijeet Apsunde
- 552
- 8
- 21
2
votes
1 answer
java.lang.ClassNotFoundException when trying to load derived class
I have two different Modules: MultiRealm and SurvivalRealm. MultiRealm provides an abstract class (LoadedRealm) which the class SurvivalRealm (in the Module SurvivalRealm) extends. Now, MultiRealm tries to load the SurvivalRealm class from the jar.…

Jakob Tinhofer
- 313
- 3
- 16
2
votes
0 answers
Using ojdbc5 and ojdbc8 driver in the same application with java11+
In my program I have to connect to several databases. For certain reasons I have to use several different ojdbc drivers, e.g. ojdbc5.jar, ojdbc8.jar, etc. Nothing can be changed about that.
With Java 8 it works like this:
import java.io.File;
import…

Amen
- 80
- 8
2
votes
1 answer
Create Classloader with only classes inside specific folder
I want to load specific jars in ScriptEngineManager using specific ClassLoader
This constructor loads the implementations of ScriptEngineFactory visible to the given ClassLoader using the service provider mechanism.
The problem when I tried to…

Ori Marko
- 56,308
- 23
- 131
- 233
2
votes
1 answer
URLClassLoader not loading the resources
I have written a program which manages a plugin which is provided as jar.
I load the plugin classes using an URLClassLoader which works as it's supposed to.
I had added some resources (XML file) which are stored in the plugin jar.
If I invoke a…

Garsov
- 31
- 6
2
votes
1 answer
Does URLClassLoader use lazy loading?
I'm using URLClassLoader to load jars at runtime from a server URL (let's say: http://jarsToBeLoaded/jars/). I load commons-collection.jar, commons-httpclient.jar and commons-io.jar, for example. My question is: those jars are downloaded as soon as…

lucasdc
- 1,032
- 2
- 20
- 42
2
votes
1 answer
Groovy Extension Module Method - No Signature of Method
I've created two groovy extension modules / methods on java.util.ArrayList(). It's all working very well inside my IDE. I use gradle to build the jar, and deploy it to a remote JVM. When it reaches the remote JVM, it fails.
Here is the extension…

solvingJ
- 1,321
- 1
- 19
- 30
2
votes
2 answers
Programming a game in java. I need to read class files from a related directory, and return an object created from those
I can get/create the directory of the file but have trouble returning the correct data type.
public fighter rndmFighter(int z) throws Exception
{
File here = new File("encounter.java");
String path = here.getAbsolutePath();
path =…

xcannibalrabbit
- 29
- 3
2
votes
1 answer
Do I need to create custom ClassLoaders to support new archives format?
I need to support loading classes from other types of archives(tar.gz,tar.bz2...) and custom types defined by third parties. Do I need to override the 'loadClass' method to achieve that? (Perhaps theres another extension point for doing this? I…

Thiago Padilha
- 4,590
- 5
- 44
- 69
2
votes
2 answers
Loading classes from a set of files
I have a task to check a set of conditions for unknown set of classes from classpath. I want to scan it for classes, load each of them and perform my checks. Now I have a set of urls to class files and I try to use URLClassLoader. But to load a…

dbf
- 6,399
- 2
- 38
- 65
2
votes
0 answers
Java class loading from jar file at runtime in Tomcat
I need to load some servlet from jar file and map it to the URL in Tomcat.
Servlet code is
package net.arturik.mymodulepackage;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import…

Arthur
- 3,253
- 7
- 43
- 75
2
votes
0 answers
ClassNotFoundException for compiled JSP classes (Tomcat, Jasper)
I'm diagnosing a customer issue that crops up very occasionally: ClassNotFoundExceptions for classes compiled from JSPs. Most of the time everything works fine, but every so often (maybe once every couple of weeks across a dozen-ish nodes) Tomcat…

Aron
- 1,552
- 1
- 13
- 34
2
votes
2 answers
How to load a class from a .jar Android
I have this code.
I manually add the rectanglecalcul.jar in the folder data/data/com.xxx.xxx/files and the Log confirms file exist is true. This is the second part of my project, in the first part, I tried to download the JAR file from my server (it…

user3812413
- 41
- 6
2
votes
1 answer
URLClassLoader keeps throwing ClassNotFoundException. What am I doing wrong?
I'm working on a university java project that requires me to implement a simple plugin architecture. A main application in Project A would have to load plugins from a specified directory located in another project B. After having done some research…

Stefan Savolainen
- 21
- 1
- 5