How to use dispose to release resources in java?
I have an attached code and its exception maybe it not relevant in Sololearn discussions or questions but it a problem I'm facing hoping fellow programmer can help me with. The code is based on Tesseract tess4j version 4.5.4 in java 8. I take screenshot using BufferedImage. On average the screenshot is taken every 5 seconds daily then read image text for every screenshot taken. The images are not saved on file. For now I'm testing this code on a virtual machine which I'm running it for two weeks consecutively and everything is working fine until the 3th or 4th day of testing. I then get the the attached exception. When I use the "dispose" to dispose of the instance and start a new one. The Eclipse system says "create dispose method" does this method not internally available? Code: https://code.sololearn.com/cVJOG66IePq0/?ref=app Exception: https://code.sololearn.com/c6Za6rrcOrZn/?ref=app