How to delete a directory when the virtual machine terminates in Java

1 Answer

0 votes
package javaapplication1;

import java.io.File;
import java.io.IOException;

public class JavaApplication1 {

    public static void main(String[] args) throws IOException {

        try {
            
            File file = new File("d://tmp");

            file.deleteOnExit();
            
        } catch (Exception e) {
            System.out.print(e);
        }
    }
}


/*
        
run:
  

    
 */

 



answered Nov 16, 2016 by avibootz

Related questions

1 answer 166 views
1 answer 217 views
1 answer 88 views
2 answers 184 views
1 answer 184 views
1 answer 242 views
...