Hello:
I created a Hello class and followed the instruction on
http://java.sun.com/j2se/1.5.0/docs/guide/jpda/trace.html for Tracing the method calls at runtime. However while launching Trace tool, it does not seem to use the classpath setting in order to find my Hello class. Hello.java does not have package directive and is created in "D:\tmp\java-example". As shown below in Step 1, if I run my program from D:\tmp\java-example then the Trace tool is able to find the program. However if I am in any other directory and set D:\tmp\java-example in the CLASSPATH (as shown in Step 2 below) or provide it as value to jvm -classpath argument (as shown in Step 3 below) then the Trace tool is unable to find my Hello class.
Step 1:
D:\tmp\java-example>java com.sun.tools.example.trace.Trace Hello
-- VM Started --
====== main ======
main -- Hello
| <init> -- Hello
| methodA -- Hello
| | methodC -- Hello
| methodB -- Hello
====== main end ======
-- The application exited --
Step: 2
D:\tmp\java-example>echo %CLASSPATH%
"D:\tmp\java-example\;C:\Program Files\Java\jdk1.6.0\lib\Tools.jar;C:\Program Files\Java\jdk1.6.0\demo\jpda\;"
D:\tmp\java-example>cd ..
D:\tmp>java com.sun.tools.example.trace.Trace Hello
java.lang.NoClassDefFoundError: Hello
Exception in thread "main" -- VM Started --
-- The application exited --
Step: 3
D:\tmp>java -classpath "D:\tmp\java-example\;C:\Program Files\Java\jdk1.6.0\lib\
Tools.jar;C:\Program Files\Java\jdk1.6.0\demo\jpda\;" com.sun.tools.example.trac
e.Trace Hello
java.lang.NoClassDefFoundError: Hello
Exception in thread "main" -- VM Started --
-- The application exited --
Any help is much appreciated.
Thanks,