title: How to Solve Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
body: <p>I am Trying to Read xml file of size 10 MB. I am Using Windows7 Operating system (8GB RAM ), Netbeans 7.1.2</p>
  
  <pre><code>    C:\&gt;java -version
      java version "1.7.0_05"
      Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
      Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)
  
  C:\&gt;free -m
               total       used       free     shared    buffers     cached
  Mem:          8169       3175       4993          0          0          0
  -/+ buffers/cache:       3175       4993
  Swap:         8169         81       8087
  </code></pre>
  
  <p>I have tried <code>C:\&gt;java -Xms5120m -Xmx6144m</code> But not helping.</p>
  
  <p>StackTrace:</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
      at org.apache.xerces.xni.XMLString.toString(Unknown Source)
      at org.apache.xerces.parsers.AbstractDOMParser.characters(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanContent(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
      at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
      at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:208)
      at ReadExcel.xmlappend(ReadExcel.java:343)
      at ReadExcel.jButton7ActionPerformed(ReadExcel.java:331)
      at ReadExcel.access$600(ReadExcel.java:42)
      at ReadExcel$7.actionPerformed(ReadExcel.java:176)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
      at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
      at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
      at java.awt.Component.processMouseEvent(Component.java:6038)
      at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
      at java.awt.Component.processEvent(Component.java:5803)
      at java.awt.Container.processEvent(Container.java:2058)
      at java.awt.Component.dispatchEventImpl(Component.java:4410)
      at java.awt.Container.dispatchEventImpl(Container.java:2116)
      at java.awt.Component.dispatchEvent(Component.java:4240)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
      at java.awt.Container.dispatchEventImpl(Container.java:2102)
      at java.awt.Window.dispatchEventImpl(Window.java:2429)
  </code></pre>