Questions tagged [urlclassloader]

This class loader is used to load classes and resources from a search path of URLs referring to both JAR files and directories.

286 questions
1
vote
1 answer

Load jar file dynamically and create spring beans using xml

I have an application which gets deployed as war file in application server. I have a requirement of adding a new jar file at runtime without stopping the service. and later i will create beans from the bean xml definitions stored in database. I…
sasidhar
  • 43
  • 7
1
vote
1 answer

Delegation of custom class loader in RMI

Update: Added some more info as the workaround is not working reliably I have a RMI module that I load with a custom classloader vie spring beans. This class loader is also used to load that module. The ClassLoader inherits from URLClassLoader. The…
1
vote
2 answers

Java: Automatic Custom ClassLoader

My application uses the Standard Widget Toolkit (SWT) for it's GUI. My problem is that the 32-bit SWT library does not work on a 64-bit JVM. But I don't want to make people select the correct architecture when getting the software. So, I want to…
Jonah
  • 9,991
  • 5
  • 45
  • 79
1
vote
1 answer

JarFileFactory caching jar files

I have spring boot application, it consists of 2 modules: frontend and spring boot app project (frontend is gradle dependency of spring boot app). If I run gradle bootRun app starts and works correctly, then I change something, gradle rebuilds…
Alex T
  • 2,067
  • 4
  • 20
  • 27
1
vote
2 answers

Loading class through Jars in scala

I am trying to load a class from target Jar, I saw some examples and tried to replicate, but unfortunately i couldn't. What am I doing wrong here: import java.io.File import java.net.{URL, URLClassLoader} val jarPathName = "C:\\Users\\Pedro…
Pedro Correia Luís
  • 1,085
  • 6
  • 16
1
vote
1 answer

URLClassLoader not working

I want to load a file in the directory F:/badge-dao/bin/com/badge/dao/impl/, named BadgeDaoImpl. I am writing and testing the following code. If I change the directory or the class name, it throws an exception. For the following code, which I…
user668441
  • 11
  • 3
1
vote
1 answer

ClassNotFoundException when trying to load a class from a jar file at runtime in Java

I am trying to execute a function from a class in a jar file dynamically. I have the location of the jar file, the name of the class and the function in it as strings. I looked at these questions, but none of the answers worked for me: How should I…
Vesk
  • 138
  • 3
  • 13
1
vote
0 answers

in tomcat,how to get annotations on class in other project

in tomcat,there are two projects under webapps , A and B 。 In project A ,I want to get annotations on class in B,the same code ,I can get annotations in common java project,but in springmvc,I cannot get any annotation. why? here are the core…
easonwang
  • 11
  • 1
1
vote
1 answer

Provider not a subtype inside docker container

Situation I'm developing an application that uses Java's URLClassLoader and ServiceLoader to load jar files. Inside these jar files is the provider that implements my interface. The folder structure is as described in this post by oracle meaning…
Oromë
  • 199
  • 2
  • 16
1
vote
1 answer

URLClassLoader can't find class thats in different directory

I'm making eclipse plug-in, and I need to access selected class from some random project in eclipse. I extracted selected file: IPath className; Object firstElement, firstElement1; /* Setting service to track when some object is selected in active…
squlerr
  • 11
  • 8
1
vote
1 answer

ClassNotFound with URLClassLoader loading a Jar

Using the following code I get a ClassNotFoundException File jarFile = new File(jar); URL jarUrl = new URL("jar", "", jarFile.getAbsolutePath() + "!/"); URLClassLoader loader = new URLClassLoader( new URL[] {jarUrl},…
J. Pichardo
  • 3,077
  • 21
  • 37
1
vote
0 answers

Add a generated jar in the ModuleClassLoader of JBoss

My application generates dynamically some JARS that I need to put in the classpath. In Tomcat I have no problems, due to the ClassLoader extends from URLClassLoader, and I can call addUrl method by reflection, and the JAR is available…
Marc Gil Sendra
  • 819
  • 2
  • 9
  • 22
1
vote
1 answer

Protecting Java classes behind login

I have a Java application that I want to add a licencing system to. I have created a serial key system that will be used to validate the software before launch on a remote server. What I really wish to do, is host a .jar or .zip file on the remote…
1
vote
1 answer

java urlclassloader usage.Is it needed only in some rare cases?

In which case one would use a URLClassLoader to load a class from a specific jar in a specified path? E.g. URL url = new URL("file:///path/to/customClasses.jar"); URLClassLoader pluginLoader = new URLClassLoader(new URL[] { url }); Class cl =…
Cratylus
  • 52,998
  • 69
  • 209
  • 339
1
vote
1 answer

Viewing loaded properties file from Java Classloader

Jar1 has a properties file name abc.properties and Jar2 also has same file abc.properties. Like this i have more than 100 jars. Is there any mechanism to understand from which jar the abc.properties is loaded. I know it is based on the precedence…
nsarvesh
  • 37
  • 1
  • 2
  • 9