java – Eclipse – different outputs in ubuntu and windows

There are some times I decided to install ubuntu 18.04 but I had a problem …
I'm doing a project in Java but exactly the same code is giving a different output in ubuntu and in windows. More specifically, it is a client-server program in which I have a thread that a client handles. In the run of the same, a function of the connection () that connects the thread to the socket (which in turn is connected to the client) is invoked, when the program is closed, supposedly, an exception is thrown because the thread stops connecting to the socket and so, with a try catch, I "rush" the exception and try to remove that client from a list (in the windows). However, in Ubuntu, for a reason still unknown, that same exception does not get launched and so I can not remove the client. The code is the same and I have already tried installing different versions of eclipse in ubuntu, always passing the same one.
I hope you have made me understand and I apologize if the terminology is not the most adequate but I am a novice and I am studying.
Does anyone have any ideas?