作为一名JAVA初学者,我尝试通过教程使用GRAL。我是约以下错误:关于来自GRAL安装的super()关键字和.properties文件的JAVA问题
java.lang.RuntimeException: java.io.IOException: Property file not found: drawablewriters.properties
从不变GRAL源代码的以下各行来到此运行时错误:
public final class DrawableWriterFactory extends AbstractIOFactory<DrawableWriter> {
/** Singleton instance. */
private static DrawableWriterFactory instance;
/**
* Constructor that initializes the factory.
* @throws IOException if the properties file could not be found.
*/
private DrawableWriterFactory() throws IOException {
super("drawablewriters.properties"); //$NON-NLS-1$
}
/**
* Returns an instance of this DrawableWriterFactory.
* @return Instance.
*/
public static DrawableWriterFactory getInstance() {
if (instance == null) {
try {
instance = new DrawableWriterFactory();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return instance;
}
上面的类是在其中引用的那是代码另一个类参考最初运行。
在阅读关键字super后,似乎super在构造函数中使用时永远不会有.properties文件作为参数。在这种情况下它如何使用.properties文件?
我在下面的question中注意到一个新的InputStream通常用于提取.properties文件的内容。这是以某种方式完成超级?
此外,我只是试图将drawablewriters.properties放在与上面源代码相同的目录中。这没有奏效。
好的,谢谢Jim。 – brb