NoClassDefFoundError **ONLY** if using Xdebug

Hi;

On a xpPro system, with J2SE 1.4.2, Java cannot find my main class, IF and only IF I try to run it with the options required to make it a debugee. From the exact same directory all works ok with the exact same command line less the Xdebug stuff.

Here is the command I tried: (I tried with and without the -classpath option. It works either way under normal execution.)

java -Xdebug -Xnoagent -Djava.compiler=NONE Xrunjdwp:transport=dt_socket,server=y,address=8888,suspend=n -classpath .myPackage.myClass.

And here is what I get:

Exception in thread "main" java.lang.NoClassDefFoundError: Xrunjdwp:transport=dt_socket,server=y,address=8888,suspend=n

Your help is most appreciated.

By the way, I am using sockets because I plan to debug this from another Windows machine on the lan.

Thanks

-nat

[873 byte] By [nnatgrossa] at [2007-9-29 9:12:48]
# 1

[...]

> java -Xdebug -Xnoagent -Djava.compiler=NONE

> Xrunjdwp:transport=dt_socket,server=y,address=8888,susp

> nd=n -classpath . myPackage.myClass.

>

> And here is what I get:

> Exception in thread "main"

> java.lang.NoClassDefFoundError:

There are two JVMs involved when you are tracing or debugging.

Your classpath is only getting to one of them (the debugger).

Rather than putting the classpath on your command line, you can:

1) Set CLASSPATH as an environment variable so that both JVMs can use it

(because they will both inherit it from the parent process).

2) Or, since you are doing distributed debugging,separate debugger and debugee.

Start the debugee program in one command window:

java -classpath <whatever> -Xdebug \

-Xrunjdwp:transport=dt_socket,server=y,address=4571 -verbose:class \

HelloWorld

In another window (on some other machine), attach your debugger (jdb in

this example) to the debugee via a socket:

jdb -connect com.sun.jdi.SocketAttach:hostname=<some host>,port=4571

> By the way, I am using sockets because I plan to debug

> this from another Windows machine on the lan.

Good for you!

debugging_teama at 2007-7-14 22:48:47 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 2

Either I don't understand, or possibly you didn't get the problem. I am talking about the same jvm, the debugee. If I run "HelloWorld" without all the debug options, java myPackage.HelloWorld it does work 100% ok. But at the exact same command prompt, even immediately after (or before) running the program as described, if I precede the Xdebug stuff on the java command line, it can't find the class!

thanks,

-nat

nnatgrossa at 2007-7-14 22:48:47 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 3
wow, my message posted exactly 12 hours later than yours..
nnatgrossa at 2007-7-14 22:48:47 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 4
What a goof! I didn't put a dash '-' in front of xrunjdwp (see my original post).It's working now.-nat
nnatgrossa at 2007-7-14 22:48:47 > top of Java-index,Archived Forums,Debugging Tools and Techniques...