Created
June 18, 2015 18:14
-
-
Save hinerm/ac02be7beacaa1a065b3 to your computer and use it in GitHub Desktop.
Test the ability of a jar to overwrite itself
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.scijava; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
public class Main { | |
public static void main(String... args) throws IOException { | |
//FIXME: set this path to the location of the jar containing this main class. | |
String url = "C:/Users/Johannes/loci/test/target/scijava-tests-2.43.1-SNAPSHOT.jar"; | |
FileOutputStream output = new FileOutputStream(url, false); | |
for (int i=0; i<100000; i++) { | |
output.write(0); | |
} | |
output.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So, to be clear: this works! On Windows. No file locking issue.