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
0
votes
1 answer

Java URLClassLoader: select which classes to import

Currently I'm using this line to load a 3rd party JAR and add its packages/classes to my program URL [] urls = new URL [] { "http://..." }; new URLClassLoader(urls); The problem I have with this approach is that the whole JAR is loaded, meaning all…
Flavio
  • 846
  • 1
  • 9
  • 21
0
votes
2 answers

NoClassDefFoundError (change class name)

I tried to change a classname by overriding the loadClass(String, Boolean) method. I am creating a BukkitPlugin. The Bukkitsource can be found here The classloader itself is working fine, i tested it and all the classes worked fine, the error…
Leo
  • 11
  • 2
  • 7
0
votes
1 answer

Setting User Agent of URLClassLoader

Alright, so. I have my own website with a applet loaded in a jar. I want to use a java program to load the jar through a URLClassLoader, and start the applet that way. I'm using this code: classLoader = new URLClassLoader(new URL[]{new…
Chris Shafer
  • 68
  • 1
  • 6
0
votes
1 answer

ClassNotFoundException loading runtime compiled subclass

I am using JavaCompiler to compile CustomProcessor.java from within a web application at runtime package com.notmycompany; import com.mycompany.Processor; import com.mycompany.Event; public class CustomProcessor extends Processor { @Override …
MonoThreaded
  • 11,429
  • 12
  • 71
  • 102
0
votes
1 answer

Dynamically load class in Linux Java

I'm doing as a school project a multi-platform Distributed Data Base System I need to extract data from the Data Base in Java so i dynamically load my jdbc connector Works Perfect in Windows But in Linux I got the error: "No suitable driver found…
0
votes
1 answer

Java reflection: How can I load a class from another project without adding that project or JAR to my classpath?

Here's my situation: I have a class in project A. I want to load this class in a method in project B without adding project A (or a JAR containing the class) to my project B classpath (I personally have no objection to doing it that way, but I must…
0
votes
1 answer

Reading bytes from a class

I am trying to get a class from a path on a file system, and get the bytes from it. I have tried what is below, but have had no success. This should just print out the name for now. If anyone has any ideas on how to do what I am doing, please let me…
JNorr44
  • 276
  • 1
  • 2
  • 11
0
votes
1 answer

Load jar dynamically

In my java application, I read a jar file (packaged with Maven shade plugin) into a bytestream. In the jar there is a entrypoint class defined in POM.xml ... ...
quarks
  • 33,478
  • 73
  • 290
  • 513
0
votes
1 answer

Can't seem to get my class to load using UrlClassLoader

So I made a super-simple file, and shot it up onto my server at: http://myServer:8080/testApp/ In there is testApp.jar and a folder that acts as bin. I've tried a few things to fix this but I keep getting: Exception in thread "main"…
A_Elric
  • 3,508
  • 13
  • 52
  • 85
0
votes
0 answers

URLClassLoader : How to set the URL

Suppose in tomcat,It have two applications :app1 and app2,the folder structure is as below tomcat6 -webapps -app1 -WEB-INF -lib -test1.jar -app2 -WEB-INF -lib …
Chailie
  • 451
  • 2
  • 11
  • 24
0
votes
1 answer

URLClassLoader issue for jars created with JarOutputStream

the URLClassLoader class fails to load classes from the jar created programatically using the code listed below, whereas when i create a jar with the same classes using jar cf %jarname% %sources% it works fine. Is there a difference between the jars…
keshav84
  • 2,291
  • 5
  • 25
  • 34
0
votes
0 answers

URLClassLoader, "hot-swapping" jar files and ClassFormatError - weird behavior

Rewritten from scratch @ Friday, 25 May, about 16:00 GMT (Code is cleaner now, bug can be reproduced and the question is more clear) Original problem: I'm writing a server app that's required to accept files from clients over the net and process…
Timekiller
  • 2,946
  • 2
  • 16
  • 16
0
votes
2 answers

URLClassLoader does not read external JAR library of a plugin

I have implemented a simple plugin based application with Java. Main plugin class is derived from and abstract class called "Plugin". The application reads that class from JAR file and runs the plugin by creating an instance of the class. Standard…
Selçuk Öztürk
  • 975
  • 1
  • 14
  • 23
0
votes
1 answer

Prevent 3rd party classloader from loading a class

I'm invoking third party code method.invoke(null, args); and it has a classloader that loads a class. Is it possible that I can prevent it from loading a specific class? Also There is more than one third part program that I am invoking and I am…
jtzero
  • 2,204
  • 2
  • 25
  • 44
-1
votes
1 answer

Load external classes

I am trying to load external classes in my project. My idea is to load a class and then use reflection to get its properties and methods. I am trying to do this, but it doesnt work Path destination =…
David Marciel
  • 865
  • 1
  • 12
  • 29
1 2 3
19
20