I have a Java program that loads thirdparty class files (classes I did not write) and executes them. These classes often use java.util.Random, which by default generates random starting seed values every time it gets instantiated. For reasons of reproducability, I want to give these classes the same starting seed every time, changing it ...
Hi there,
I've just solved another I-though-I-was-using-this-version-of-a-library-but-apparently-my-app-server-has-already-loaded-an-older-version-of-this-library-issue (sigh).
Does anybody know a good way to verify (or monitor) whether your application has access to all the appropriate jar-files, or loaded class-versions?
Thanks in a...
Hi,
I was asked to build a java system that will have the ability to load new code (expantions) while running.
How do I re-load a jar file while my code is running? or how do I load a new jar?
Obviously, since constant up-time is important, I'd like to add the ability to re-load existing classes while at it (if it does not complicate ...
Developing a heavily XML-based Java-application, I recently encountered an interesting problem on Ubuntu Linux.
My application, using the Java Plugin Framework, appears unable to convert a dom4j-created XML document to Batik's implementation of the SVG specification.
On the console, I learn that an error occurs:
Exception in thread "...
My usage case is compiling generated source files from a java program using the ToolProvider and JavaCompiler classes provided in JDK 6. The source files contain references to classes in the context classloader (it runs in a J2EE container), but not in the system classloader. My understanding is that by default the ToolProvider will cre...
I have a java file TestThis.java like following:
class A
{
public void foo()
{
System.out.println("Executing foo");
}
}
class B
{
public void bar()
{
System.out.println("Executing bar");
}
}
The above code file is compiling fine without any warnings/errors. My question is that is there any way ...
I am writing a curriculum project for students new to Java. It has a folder structure as so.
myjar.jar
solutions/my/really/long/package/MySolution.class
I got it so the jar can load all classes in the solutions/my/really/long/package/ directory.
by adding 'solutions/' to the classpath.
My question is if it is possible to set it up so...
In Java, can Class.forName ever return null, or will it always throw a ClassNotFoundException or NoClassDefFoundError if the class can't be located?
...
Is it possible to know whether a Java class has been loaded, without attempting to load it? Class.forName attempts to load the class, but I don't want this side effect. Is there another way?
(I don't want to override the class loader. I'm looking for a relatively simple method.)
...
Here is the problem I'm running into. There's a huge legacy application that runs on java 1.3 and uses external API, say, MyAPI v1.0. The exact implementation of MyAPI 1.0 is located somewhere in the classpath used by the app. There's also a mechanism that allows that app to use external code (some kind of plugin mechanism). Now I have a...
I've got a Java web application (using Spring), deployed with Jetty. If I try to run it on a Windows machine everything works as expected, but if I try to run the same code on my Linux machine, it fails like this:
[normal startup output]
11:16:39.657 INFO [main] org.mortbay.jetty.servlet.ServletHandler$Context.log>(ServletHandler.java...
Can anyone point me a good resource or explain me about the concept behind Class Loaders? I found the following resource on class loaders http://www.onjava.com/lpt/a/5586 but still no help. The following questions may look silly but trying to answer them always confuses me.
Why do developers write Custom class loaders, why not invoke a...
I've an issue with a project I try to deliver using the one-jar packager to simplify the deployment process.
Without the packaging, everything works fine and the logging configuration is perfectly loaded, but within the packaging, only part of the configuration is appied.
So, here is the logging.properties I use:
handlers= java.util.lo...
How can one reach web-module isolation (i.e. each contained web-app is isolated from the others in the same .EAR) in jboss 4.2.2 when deployed inside a isolated .EAR file?
Jboss 4.2.2 keeps warning that web-module (jboss-web) level deployment descriptor class loading configuration is ignored when deployng an EAR file.
...
In our web apps the first load of some pages takes a small but noticeable extra about of time due to class loading. Does anyone have any clever ways of preloading web app classes in the JVM on start up?
Update: What we do now is store a bunch (700) of full class names in a db table. We read the table at startup and do Class.forName()...
Hi everybody, this is my first question here in stackoverflow (and I hope not the last one :P).
To debug class loading in a JVM we can use the param -verbose:class, but... Anyone knows how to debug resources loading (e.g. properties files)?
Thank you in advance!
...
Like most web developers these days, I'm thoroughly enjoying the benefits of solid MVC architecture for web apps and sites. When doing MVC with PHP, autoloading obviously comes in extremely handy.
I've become a fan of spl_autoload_register over simply defining a single __autoload() function, as this is obviously more flexible if you ar...
Does anybody know a good way to find the file size that is dynamically loaded by urlclassloader?
I am using the urlclassloader in the following manner, but need to keep track of how much bandwidth is being used.
URLClassLoader sysloader = (URLClassLoader) ClassLoader
.getSystemClassLoader();
Class<URLClassLoader> sysclass = URLCla...
In Java, you can load all kinds of resources using the same API but with different URL protocols:
file:///tmp.txt
http://127.0.0.1:8080/a.properties
jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class
This nicely decouples the actual loading of the resource from the application that needs the resource, and since a URL is just a Str...
I started to ask this question and then figured out the answer before submitting it. I've decided to post the question anyway so that other people who run into the same problem will be able to learn from my mistakes.
I'm having a problem with an applet (a JApplet actually) unable to instantiate another class which is included in the s...