决定使用Apache的Common Configuration包来解析XML文件.
我决定做一个:
XMLConfiguration xmlConfig = new XMLConfiguration(file);
Run Code Online (Sandbox Code Playgroud)
Eclipse抱怨我没有捕获异常(Unhandled exception type ConfigurationException),所以我点击了可靠性surround with try/catch并添加了以下代码:
try
{
XMLConfiguration xmlConfig = new XMLConfiguration(file);
}
catch (ConfigurationException ex)
{
ex.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
然而现在它抱怨:
No exception of type ConfigurationException can be thrown; an exception type
must be a subclass of Throwable
Run Code Online (Sandbox Code Playgroud)
我不明白为什么当Eclipse是建议添加它时,它给了我这个错误.