Java Hashmap对象到特定文件夹中的XML

Java Hashmap对象到特定文件夹中的XML,java,xml,jaxb,directory,Java,Xml,Jaxb,Directory,我正在尝试将Hashmap对象发送到XML文件中。我的目标如下: @XmlRootElement Public class myObjectToHashmap long id; boolean bool; String name; long date; public static void GetMyObject(long id,boolean bool, String name) { myObjectToHashmap newObject = new myObjectToHashma

我正在尝试将Hashmap对象发送到XML文件中。我的目标如下:

@XmlRootElement
Public class myObjectToHashmap
long id;
boolean bool;
String name;
long date;

public static void GetMyObject(long id,boolean bool, String name)
{
    myObjectToHashmap newObject = new myObjectToHashmap();
        newObject.id= id;
        newObject.date = new Date().getTime();
        newObject.name = name;
        newObject = bool;
    PlaceOfMyHashmap.myHashMap.put(id, newObject)
 }
以下是我的HashMap的位置:

public class PlaceOfMyHashMap
{
    public static HashMap<Long, myObjectToHashMap> myHashMap = new HashMap<~>
}
然后,我真的不明白为什么它不能生成任何东西,我也不知道如何添加文件夹的位置

当我调试时,它只是说它是一个无效的表达式。。。有什么建议吗

例外情况如下:

marshaller.mashal(~); Method threw 'javax.xml.bind.JAXBException' exception. 
errorCode = null linkedException = null detailMessage = "class.java.util.HashMap and none of its superclass are known in this context" 
detailMessage = "javax.xml.bind.JAXBException and none of its superclass are known in this context" 
stackTrace = {java.lang.StackTraceElement[6]@882 suppressedExceptions = size=0

什么是无效表达式?此行:marshaller.marshal(PlaceOfMyHashMap.myHashMap,System.out);你能发布整个调试输出吗?我在文章末尾添加了它们:marshaller.mashal(~);方法引发了“javax.xml.bind.JAXBException”异常。errorCode=null linkedException=null detailMessage=“class.java.util.HashMap,在此上下文中其超类均未知”detailMessage=“javax.xml.bind.JAXBException,在此上下文中其超类均未知”stackTrace={java.lang.StackTraceeElement[6]@882 suppressedExceptions=size=0
marshaller.mashal(~); Method threw 'javax.xml.bind.JAXBException' exception. 
errorCode = null linkedException = null detailMessage = "class.java.util.HashMap and none of its superclass are known in this context" 
detailMessage = "javax.xml.bind.JAXBException and none of its superclass are known in this context" 
stackTrace = {java.lang.StackTraceElement[6]@882 suppressedExceptions = size=0