我基本上有一个程序使用apache poi将记录从一个excel文件过滤到另一个excel文件。当我使用netbeans运行时,我的程序运行正常。但是,在干净并构建并双击dist文件夹中的.jar文件时,它会运行很长时间(太长时间!)并给出以下错误(我通过从命令提示符运行程序得到)。 / p>
有任何解决方法吗?在清理和构建之前,我已经将堆大小增加到netbeans中的-Xms1500m。
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
at org.apache.xmlbeans.impl.store.Saver$TextSaver.resize(Saver.java:1592)
at org.apache.xmlbeans.impl.store.Saver$TextSaver.preEmit(Saver.java:1223)
at org.apache.xmlbeans.impl.store.Saver$TextSaver.emit(Saver.java:1144)
at org.apache.xmlbeans.impl.store.Saver$TextSaver.emitElement(Saver.java:926)
at org.apache.xmlbeans.impl.store.Saver.processElement(Saver.java:456)
at org.apache.xmlbeans.impl.store.Saver.process(Saver.java:307)
at org.apache.xmlbeans.impl.store.Saver$TextSaver.saveToString(Saver.java:1727)
at org.apache.xmlbeans.impl.store.Cursor._xmlText(Cursor.java:546)
at org.apache.xmlbeans.impl.store.Cursor.xmlText(Cursor.java:2436)
at org.apache.xmlbeans.impl.values.XmlObjectBase.xmlText(XmlObjectBase.java:1455)
at org.apache.poi.xssf.model.SharedStringsTable.getKey(SharedStringsTable.java:130)
at
org.apache.poi.xssf.model.SharedStringsTable.addEntry(SharedStringsTable.java:176)
at org.apache.poi.xssf.usermodel.XSSFCell.setCellType(XSSFCell.java:755)
at equity.EquityFrame_Updated.copyRowsFromOldToNew(EquityFrame_Updated.java:646)
at equity.EquityFrame_Updated.init(EquityFrame_Updated.java:133)
at equity.EquityFrame_Updated.createAndShowGUI(EquityFrame_Updated.java:71)
at equity.EquityFrame_Updated.<init>(EquityFrame_Updated.java:50)
at equity.FileOpener.generateButtonPressed(FileOpener.java:160)
at equity.FileOpener.access$100(FileOpener.java:17)
at equity.FileOpener$2.actionPerformed(FileOpener.java:61)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
答案 0 :(得分:2)
&#39; -Xms1500m&#39; flag是运行时标志,而不是编译时标志。你已经在Netbeans中设置了它,所以当你运行Netbeans时它只会得到那个标志。
当你在Netbeans之外运行程序时,你需要像这样运行它:
java -Xms1500m -jar [你的节目在这里]。