我将 Individual.XML 放在目录中: Files \ InputApps
<?xml version="1.0" encoding="UTF-8"?>
-<topmostSubform>
-<Header1>
<TextField2>**A123**</TextField2>
</Header1>
只想打印出来&#34; A123 &#34;但是我得到了错误:
Exception in thread "main" java.lang.NoClassDefFoundError: org/xmlbeam/XBProjector
at rb.form.submitter.Function_Library.printWeatherData(Function_Library.java:758)
at rb.form.submitter.RB_base.main(RB_base.java:81)
Caused by: java.lang.ClassNotFoundException: org.xmlbeam.XBProjector
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
请参阅下面的XMLBean代码:
@XBDocURL("resource://Files//InputApps//Individual.XML")
public interface XMLData {
@XBRead("/topmostSubform/Header1/TextField2")
String getValue();
}
protected void printData() throws IOException {
// We let the projector fetch the data for us
XMLData ValueData = new XBProjector().io().fromURLAnnotation(XMLData.class);
// Print some values
System.out.println("test " + ValueData.getValue());
}
答案 0 :(得分:0)
您正在使用外部库(enter link description here),但该lib在执行期间不在您的类路径中。您必须将库内容包含到jar中(创建fat jar),或者为执行提供有效的类路径(java.exe -cp ...)。