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
[...]
> 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!
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