How to Resolve a Java Language Stack Overflow Error

Save

A Java Language stack overflow occurs when the size of memory required by the stack of the Java program is greater than what the Java Runtime Environment has configured for the application. Stack overflows commonly occur due to deeply-nested applications or through infinite loops created in error by the programmer in the application. Graphics intensive programs commonly require larger Java stacks than the default value created by the Runtime Environment.

  • Open the DOS prompt on your computer by selecting the \"Start\" menu and type \"command\" in the search text field followed by the \"Enter\" key.

  • Change the directory to the program that you are going to resolve the Java Language Stack Overflow error. To do this, type \"cd \" followed by the fully qualified directory path of the class files. An example of this is: \"cd c:\myjavaprograms\".

  • Change the max Java stack size for the program to 1024 kilobytes. This will determine if your program's stack overflow is due to a deeply-nested loop in your program. To do this, type the following command followed by the \"Enter\" key:
    java –Xss1024k YourClassNameHere

  • Exit the Java program run in Step 3. If you still see a Stack overflow exception output to the console, then you have resolved your overflow problem to an infinite loop in your programming code. You will need to examine the loops in your programming code in order to further resolve. If you do not see a Stack overflow exception, then the issue was inadequate stack memory being allocated for your program to properly execute.

References

Promoted By Zergnet

Comments

Resources

You May Also Like

Related Searches

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!