test/com/sun/jdi/OptionTest.java

Print this page

        

*** 30,39 **** --- 30,42 ---- * @run compile -g OptionTest.java * @run compile -g HelloWorld.java * @run compile -g VMConnection.java * @run main/othervm OptionTest */ + + import java.net.ServerSocket; + public class OptionTest extends Object { private Process subprocess; private int subprocessStatus; private static final String CR = System.getProperty("line.separator"); private static final int BUFFERSIZE = 4096;
*** 120,135 **** return result; } public static void main(String[] args) throws Exception { String javaExe = System.getProperty("java.home") + java.io.File.separator + "bin" + java.io.File.separator + "java"; String targetClass = "HelloWorld"; String baseOptions = "transport=dt_socket" + ! ",address=8000" + ",server=y" + ",suspend=n"; /* Option combinations to try (combos faster, fewer exec's) */ String options[] = { --- 123,144 ---- return result; } public static void main(String[] args) throws Exception { + // find a free port + ServerSocket ss = new ServerSocket(0); + int port = ss.getLocalPort(); + ss.close(); + String address = String.valueOf(port); + String javaExe = System.getProperty("java.home") + java.io.File.separator + "bin" + java.io.File.separator + "java"; String targetClass = "HelloWorld"; String baseOptions = "transport=dt_socket" + ! ",address=" + address + ",server=y" + ",suspend=n"; /* Option combinations to try (combos faster, fewer exec's) */ String options[] = {