aspose file tools*
The moose likes Beginning Java and the fly likes lerning debug Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "lerning debug" Watch "lerning debug" New topic
Author

lerning debug

Shay Gaghe
Ranch Hand

Joined: Sep 03, 2001
Posts: 102
HI
im developing a web based program without the need of debuging(debug.exe). i use IDE to develop my program and i saw the tearms "breakpoint" ,"trace in" and im not sure that they like me , can you give me a good start place to learn the debug tool??
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Each IDE's debug tools are a bit different, and usually there is a built-in tutorial under the Help menu.

But as a generic help:
Breakpoint is a point in your code that you want your program to run up to.. and then pause the execution. You would normally do this if you know a very large section of your code works, and you want it to run normally until you get to the certain section of code that doesn't work quite right. At this point it enters the 'debugging mode' and you can 'step' through the program one line at a time. You would do this to examine what happens at each step in your code, and to see what variables contain what values.

Tracing usually involves some sort of diagnostic output, like a logging file. I've never used this kind of feature though, i usually go for simple System.out.println's
Shay Gaghe
Ranch Hand

Joined: Sep 03, 2001
Posts: 102
Originally posted by Mike Curwen:
Each IDE's debug tools are a bit different, and usually there is a built-in tutorial under the Help menu.

But as a generic help:
Breakpoint is a point in your code that you want your program to run up to.. and then pause the execution. You would normally do this if you know a very large section of your code works, and you want it to run normally until you get to the certain section of code that doesn't work quite right. At this point it enters the 'debugging mode' and you can 'step' through the program one line at a time. You would do this to examine what happens at each step in your code, and to see what variables contain what values.

Tracing usually involves some sort of diagnostic output, like a logging file. I've never used this kind of feature though, i usually go for simple System.out.println's

thanks for he reply Mike
why do you prefer to use System.out.println instead of debug and what's the benfits to use each of them?
thanks
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Well, there are many times where I won't necessarily start up the IDE to make a simple little change.

I'll just open the java source file, make my small change, recompile from the command line, and run my program again.

In this case I'm not inside the IDE, so using the debugging facilities is not available to me.

Now that is by choice.. there are other times when IDE debugging is not available without (it seems) major pains. For example, if you develop servlets or EJB's, you need to package and deploy these classes... and unless you know how to make your IDE do remote and distributed debugging, System.out.println seems much simpler.

So having a diagnostic System.out.println("the new value is: " + variable) or System.out.println(" ** inside servlet init: about to initialize db connection") is pretty handy. For a trick on how to efficiently do this sort of thing, see: http://www.javaranch.com/ubb/Forum33/HTML/003433.html

But for other cases, I really do like the debug facility, being able to hover my cursor over a variable and peek inside it, being able to step through a program, line by line until it breaks. These are advantages too.

But my main reason for IDE's these days is CLASSPATH management and the popup help (type a dot and be presented with a list of what you could type next - saves typing)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: lerning debug
 
Similar Threads
streams vs writers and readers
Problem Running Struts Example
How can I (remote) debug jsps in AquaLogic 5.7
Problem in java mail sending using TLS
How to debug Struts program in Eclipse?