2 Replies Latest reply on May 22, 2008 6:47 PM by 843810

    RawCommandLaunch in jdb command line


      Can you help me with the following jdb command line?

      $jdb -connect com.sun.jdi.RawCommandLineLaunch:command="java -Xrunjdwp:transport=dt_socket,server=y,address=localhost:8000 Fact",address=8000
      Internal exception:
      java.lang.IllegalArgumentException: Argument server is not defined for connector: com.sun.jdi.RawCommandLineLaunch
           at com.sun.tools.example.debug.tty.VMConnection.parseConnectorArgs(VMConnection.java:122)
           at com.sun.tools.example.debug.tty.VMConnection.<init>(VMConnection.java:160)
           at com.sun.tools.example.debug.tty.Env.init(Env.java:62)
           at com.sun.tools.example.debug.tty.TTY.main(TTY.java:1010)

      Is there any special character to say that some '=' is not the separator for the name and value for the RawCommandLineAuch?

      My intention was to run a different jvm and attach that jvm to the jdb. I want to launch a jvm command:

      "java -Xrunjdwp:transport=dt_socket,server=y,address=localhost:8000 Fact"

      Then I hope that the jdb will attach to this debuggee JVM through the socket address 8000.

      The RawCommandLineLaunch seems to serve my job, but the jdb command line is quite non-trivial. The jdb can not correctly parse my command line argument.

      I can imagine a number of work arounds for this problem, but I hope that there is an elegant solution.

        • 1. Re: RawCommandLaunch in jdb command line
          You are right that the jdb command line is non-trivial in this area. Too many uses of comma and space.

          There are several problems:
          - It is not very clear in the doc

          but the RawCommandLineLaunch connector doesn't work with server=y. Instead, the debugger starts listening at the address and the debuggee connects to it. I hope this isn't a problem for you

          - jdb doesn't automatically do the launch when you use the RawCommandLineLaunch connector. You also have to specify
          - You can use "s around the commas embedded in the -Xrunjdwp option to tell jdb that those commas are not separators for the RawCommandLineLauch options.

          One thing you could do is write a script, doit.sh, that contains your java command:
          {code} java -Xrunjdwp:transport=dt_socket,address=localhost:8000 Fact{code}

          and just name that in your jdb command line:
          {code} jdb -connect com.sun.jdi.RawCommandLineLaunch:command=doit.sh,address=8000 -launch {code}

          Or, you can do it all right on the jdb command line if you are careful:

          {code} jdb -connect 'com.sun.jdi.RawCommandLineLaunch:command=java "-Xrunjdwp:transport=dt_socket,address=8000" fact',address=8000 -launch{code}
          • 2. Re: RawCommandLaunch in jdb command line
            Thank you, and your solution works for me!