public class PropHolder {
public static Properties prop;
static {
//code for loading properties from file
}
}
// Referencing the class somewhere else:
Properties prop = PropHolder.prop;
class PropHolder
is a class of my own. The class resides in the same JAR file of the main class. So that should not because any JAR is missing from classpath.
When I look in to the JAR file by jar tf myjarfile
, I can see the PropHolder.class
listed there.
Btw: the code is running fine on my local machine. But couldn't work when I deploy it with some script onto a Linux server. So I think it is not the problem of the code. But for some reason. the deploy process is very hard to track.
What could be the problem?
My best bet is there is an issue here:
static {
//code for loading properties from file
}
It would appear some uncaught exception occurred and propagated up to the actual ClassLoader attempting to load the class. We would need a stacktrace to confirm this though.
Either that or it occurred when creating PropHolder.prop
static variable.