Problem:
This is one of the Common Exceptions which we almost come across in our daily lives. When i was tried to run my java code i was getting java.lang.OutOfMemoryError. Then i tried to increase the heap size with the following command:
java -Xms64m -Xmx128m
Exception i encountered was:
"Error occured during initialization of VM Too small initial heap"
Solution:
It looked everything was perfect but the problem was.... we need to set it with every java file which we run.
Syntax:
java -Xms64m -Xmx128m "Java File Name".
For example:
I have compiled excelReport.java and got a class file then i will use -
java -Xms64m -Xmx128m excelReport
This is specific to each java class name.
Similar Exceptions:
- invalid maximum heap size
Dont forget to add m at end of each size which you type / mention in the command.
No comments:
Post a Comment