0

I basically have a program that filters records from one excel file to another excel file using the apache poi. My program runs fine when it runs using netbeans. However, upon doing a clean and build and double clicking the .jar file inside the dist folder, it runs for very long( too long!) and gives me the following error( that I got by running the program from command prompt ).

Is there any work around for it? I have already increase the heap size to be -Xms1500m inside netbeans before cleaning and building.

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)

1 Answer 1

2

The '-Xms1500m' flag is a runtime flag, not a compile time flag. You've set it inside Netbeans, so it only gets that flag when you run through Netbeans.

When you run the program outside of Netbeans, you need to run it like so:

java -Xms1500m -jar [your program here].

Sign up to request clarification or add additional context in comments.

3 Comments

How do i set it such that I double click the jar file, then it will run it like that? Thanks alot!
I think you can go with batch file for that.. double clicking on batch file will run your project.
Thanks, the batch file combined with a VBScript Script file to hide the cmd window works perfectly!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.