Java musicxmlparser错误未报告的异常
我正在做关于软件乐谱阅读器的项目,在这一部分中,我想将musicxmlparser转换为staccato/midi,但在此之前,我编写了一些代码Java musicxmlparser错误未报告的异常,java,midi,jfugue,musicxml,Java,Midi,Jfugue,Musicxml,我正在做关于软件乐谱阅读器的项目,在这一部分中,我想将musicxmlparser转换为staccato/midi,但在此之前,我编写了一些代码 public static void main(String[] args) throws InvalidMidiDataException, IOException { MusicXmlParser parser = new MusicXmlParser(); StaccatoParserListener listen
public static void main(String[] args) throws InvalidMidiDataException, IOException {
MusicXmlParser parser = new MusicXmlParser();
StaccatoParserListener listener = new StaccatoParserListener();
parser.addParserListener(listener);
parser.parse(new File("C:\\Users\\ASUS\\Documents\\Java Project\\ActorPreludeSample.xml"));
}
我犯了个错误
线程“main”java.lang.RuntimeException中的异常:不可编译的源代码-未报告的异常javax.xml.parsers.parserConfiguration异常;必须被抓住或宣布被抛出
在jfugue.ParserDemo2.main(ParserDemo2.java:18)
此错误是什么意思?此错误告诉您其中一个方法正在引发ParserConfiguration异常(提示:这是MusicXmlParser构造函数),您需要将该代码包装在try/catch块中,或者从main()方法的声明中引发该代码 您会发现parser.parse()还抛出两个异常:ValidityException和ParsingException 对于一个简单的示例,解决此问题的最简单方法是在方法声明中抛出异常:
public static void main(String[] args) throws InvalidMidiDataException, IOException, ParserConfigurationException, ValidityException, ParsingException {
你正在运行哪个版本的JFugue?