我在java中使用KML对象。我想将这个对象导出到文件。我尝试使用函数KML.marshal()来写入JAK库,但它不是successFul。 我得到这个错误:如何使用JAK库或libkml -java导出KML文件?
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/xml/bind/marshaller/NamespacePrefixMapper
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
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)
at de.micromata.opengis.kml.v_2_2_0.Kml.createMarshaller(Kml.java:642)
at de.micromata.opengis.kml.v_2_2_0.Kml.marshal(Kml.java:682)
at de.micromata.opengis.kml.v_2_2_0.Kml.marshal(Kml.java:759)
at com.nice.nicetrack.KMLGenerator.toKML(KMLGenerator.java:141)
at com.nice.nicetrack.KMLGenerator.main(KMLGenerator.java:240)
Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.marshaller.NamespacePrefixMapper
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
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)
... 17 more
我不想使用XML或字符串格式。只有KMl对象!! 请帮我! 谢谢!
2014-10-28
חנה