0

So, when my jar file runs, I want it to delete and rewrite it from a site. Windows locks the files, even though the JVM is done with it. Is there anyway to stop that from happening?

user2507230
  • 562
  • 1
  • 3
  • 12

2 Answers2

0

Propably you've created multiple threads and haven't called System.exit(0); when your programm closes. Note: The 0 indicates that everything went right.

See also When should we call System.exit in Java

Community
  • 1
  • 1
Shadow3097
  • 28
  • 7
0

Is this for updating purposes? you could do a copy of your .JAR, then open this copy via command line to update the original file, when the update finishes, you could open the original .JAR passing a parameter to delete the copy, and that's it.

The code gets a little messy but i did it some time ago and it worked.

Mateus Viccari
  • 7,389
  • 14
  • 65
  • 101