import java.net.*;

public class JarLeakRepro {
    public static void main(String[] args) throws Exception {
        // Update this path if your test.jar is elsewhere
        String jarPath = "FileDescriptorLeak/test.jar"; 
        String resource = "!/META-INF/MANIFEST.MF";
		String jarUrl = "jar:file:///" + jarPath.replace("\\", "/") + resource;

        URL url = new URL(jarUrl);
        URLConnection conn = url.openConnection();

        System.out.println("About to call getLastModified() on: " + url);
        long lastModified = conn.getLastModified();
        System.out.println("LastModified = " + lastModified);

        // InputStream in = conn.getInputStream();
        // in.close();

        System.out.println("Sleeping 30s. Try to delete/rename test.jar now.");
        Thread.sleep(60000);

        System.out.println("Done.");
    }
}