我正在编写一个类来在 java 中运行 xjc。我的代码如下:
URL url = new URL("C:\\Users\\Simran\\Desktop\\books.xsd");
SchemaCompiler sc = XJC.createSchemaCompiler();
sc.parseSchema(new InputSource(url.toExternalForm()));
S2JJAXBModel model = sc.bind();
JCodeModel cm = model.generateCode(null, null);
cm.build(new FileCodeWriter(new File("C:\\Users\\Simran\\Desktop\\books.xsd")));
但是,当我运行它时出现以下错误:
Exception in thread "main" java.net.MalformedURLException: no protocol: books.xsd
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at jaxbTest.Test1.main(Test1.java:22)
有人可以帮忙吗?