I'm trying to read an XML using JDOM2, I was testing on my computer and it worked without problem. The problem has started when I tried to use this program on a Windows Server 2012 because is giving an error "Heap space" when it tries to get the children from the Document. I tried to add more memory to the virtual machine on Windows Server but it didn't work.
I tried to use the option "SlimJDOMFactory" without success.
The size of the document is almost 150MB, and there is a total of 20.000 elements more or less.
What Can I do ?
Here is a part of my code.
List<prescription> medicamentos = new ArrayList<prescription>();
SAXBuilder builder = new SAXBuilder();
builder.setJDOMFactory(new SlimJDOMFactory());
File prescriptionFile = new File("Download" + File.separator + "Prescripcion.xml");
try {
Document document = (Document) builder.build(prescriptionFile);
Element rootNode = document.getRootElement();
List<Element> list = rootNode.getChildren();
.........
} catch(Exception a) {
}