JDB help?

Hi,

As a part of my project, I need to use Java Debugger and I'm new to this.

I want to trace the flow of control and the values of the objects at every position of my JAVA Application Program.

I'm working on RedHat Linux

& I've j2sdk1.4.0

I tried to compile the Trace.java which is in j2sdk1.4.0/demo/jpda/examples.jar, it's giving the following error messages

******

$javac Trace.java

Trace.java:144: cannot resolve symbol

symbol : class EventThread

location: class com.sun.tools.example.trace.Trace

EventThread eventThread = new EventThread(vm, excludes, writer);

^

Trace.java:144: cannot resolve symbol

symbol : class EventThread

location: class com.sun.tools.example.trace.Trace

EventThread eventThread = new EventThread(vm, excludes, writer);

^

Trace.java:184: cannot resolve symbol

symbol : class StreamRedirectThread

location: class com.sun.tools.example.trace.Trace

errThread = new StreamRedirectThread("error reader",

^

Trace.java:187: cannot resolve symbol

symbol : class StreamRedirectThread

location: class com.sun.tools.example.trace.Trace

outThread = new StreamRedirectThread("output reader",

^

4 errors

********

What I've supposed to do?

Is JPDA useful for me or it is only for the people who wants to develop their own debugger?

Thanks in advance

[1473 byte] By [bhadura] at [2007-9-29 23:47:51]
# 1

Hello. You wrote:

> I want to trace the flow of control and the values of

> the objects at every position of my JAVA Application

> Program.

>

> I'm working on RedHat Linux

> & I've j2sdk1.4.0

Item one: 1.4.0 is very old. Please, Please upgrade to the most recent J2SE release available

on this web site:

http://java.sun.com/j2se/downloads/index.html

This is important, especially if you are starting a new project.

> I tried to compile the Trace.java which is in

> j2sdk1.4.0/demo/jpda/examples.jar, it's giving the

> following error messages

> ******

> $javac Trace.java

> Trace.java:144: cannot resolve symbol

> symbol : class EventThread

> location: class com.sun.tools.example.trace.Trace

> EventThread eventThread = new EventThread(vm,

> ead(vm, excludes, writer);

> ^

[...]

> What I've supposed to do?

You need to include tools.jar on your CLASSPATH. Here is an example

where I compiled and ran trace.java:

%cd C:/j2sdk1.4.2/demo/jpda

%jar -xf examples.jar

%javac -classpath "$JAVA_HOME/lib/tools.jar;." com/sun/tools/example/trace/Trace.java

%java -classpath "$JAVA_HOME/lib/tools.jar;." com.sun.tools.example.trace.Trace -help

> Is JPDA useful for me or it is only for the people

> who wants to develop their own debugger?

I suggest you study the source code for Trace.java, as well as the JDI API documentation

at this URL:

http://java.sun.com/j2se/1.4.2/docs/guide/jpda/jdi/index.html

After you are comfortable tracing method entry/exit events using Trace.java,

you can add code to Trace.java to get the additional information you are

interested in.

If you don't want to write your own code to do this, you might be interested

in some of the tools that are available and ready to use. Take a look at

this page:

http://java.sun.com/products/jpda/using.html

Hope this helps.

debugging_teama at 2007-7-16 4:14:38 > top of Java-index,Archived Forums,Debugging Tools and Techniques...