Between 1.5.0_05 and 1.5.0_06 a length limit on 248 characters
was introduced on relative paths which can cause severe grievances
for people upgrading. Before the "fix" files of length 260 could be used.
import java.io.*;
public class TestPathLength {
private static String longFilename = "C:\\tmp\\.\\";
private static String padding = "1234567890123456789012345678901234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890";
public static void main(String[] args) {
for (int i = 230; i < 260; i++) {
String tmpName = longFilename + padding.substring(0, i) + ".txt";
try {
FileWriter fw = new FileWriter(tmpName);
fw.close();
} catch (Exception e) {
System.out.println("Failed at length: " + tmpName.length());
break;
}
}
}
}