I want to make a button that closes and deletes the app file (.jar) when it is pressed. To do that I need to get the path of the file and then delete it but I dont know how to do it becouse I dont want to hardcode the path. Like, I can type the path in code and then delete the file but what if I change the location of the file? Then the path changes, thats why hardcoding the file path is useless in this case.
So here is the question: How do I get the path where the file is located in the moment the file is opened?