public class PropHolder {
public static Properties prop;
static {
//code for loading properties from file
}
}
// Referencing the class somewhere else:
Properties prop = PropHolder.prop;
propolder是我自己的一个类。类驻留在主类的同一个JAR文件中。所以这不应该,因为类路径中缺少任何JAR。
当我通过JAR tf myjarfile查看JAR文件时,我可以看到propolder .class列在那里。
顺便说一句:代码在我的本地机器上运行良好。但是当我将它与一些脚本一起部署到Linux服务器上时就无法工作了。所以我认为这不是代码的问题。 但出于某种原因。部署过程很难跟踪。
有什么问题吗?