Java Tools Home
Mission
Projects
Weblog
Wiki
 
User Area
Become a member
Request a Project
Publicize your Project
Submit Content
Graduate your Project
 
Get Connected
JavaTools Forums
Mailing lists
 
Get Informed
Newsletter
 
 
New Tools
- Volume Viewer (Visualize and manipulate 3D data)
 
Community Goodies
WallPapers
Tools Tips (pdf)
 
 


Welcome to the Java Tools Community

Welcome to Java Tools Community, a gathering place for those interested in Java™ Development Tools. Here you'll find news, articles, discussions, great open source tools and all the help you'll need to start up your project.

 
Features
A new edition of the newsletter is available, with news, new projects and tips! If you want to receive the newsletter by email, please subscribe the announcements mailing list - or read the current issue here.
(Jan 20, 2010)
As a programmer, I spend a lot of time fixing bugs. And a considerable portion of that is the time spent on reproducing a problem. Here is how a typical such session goes. Your user reports that your program doesn't work and throws such and such exception. Or given the symptom he's describing, you suspect some "if" statements to be evaluating to false. If you are lucky and experienced, you can sometimes fix the problem through careful reasoning, but often you need to collect more data to be able to fix the bug. Logging is one such measure, but I often find myself thinking "if only I could ask him to run the program with a debugger and report what the variable 'x' refers to!" After all, a debugger is an ultimate data collection tool. Unlike logging, your program doesn't need to be written a-priori to report data. Similarly, with an ability to inspect stack frames all the way down, evaluate arbitrary expressions, and modify the state of the target problem, a debugger is a far more powerful trouble-shooting tool. The one and the only problem with asking your user to run a debugger is that it's too difficult. So to that end, I developed YouDebug. YouDebug is a debugger but it's not a debugger. It's a debugger, because it builds on top of Java Platform Debug Architecture, and therefore is capable of doing everything your debugger can do — such as attaching to another process, breaking when certain conditions are met, inspect/manipulate variables, and so on. But at the same time, it's not your typical debugger, because it's not interactive. Instead of using point-and-click and GUI. You don't need source code either. Instead, it comes with a DSL-like syntax sugar on top of Groovy that controls what YouDebug would do against the target program. Groovy was chosen so that Java programmers can comfortably write scripts, while still allowing me to do enough magic behind the scene. Let's say you have the following program, which computes a String and then do substring. public class SubStringTest { public static void main(String[] args) { String s = someLengthComputationOfString(); System.out.println(s.substring(5)); } private static String someLengthComputationOfString() { ...; } } One of your user is reporting that it's failing with the StringIndexOutOfRangeException: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1949) at java.lang.String.substring(String.java:1916) at SubStringTest.main(SubStringTest.java:7) So you know s.substring(5) isn't working, but you want to know the value of the variable 's'. To do this, let's set the breakpoint at line 7 and see what 's' is: breakpoint("com.acme.SubStringTest",7) { println "s="+s; } Now, you send this script to the user and ask him to run the program as following: $ java -agentlib:jdwp=transport=dt_socket,server=y,address=5005 SubStringTest Listening for transport dt_socket at address: 5005 And then the user executes YouDebug on a separate terminal. YouDebug attaches to your program, and your script will eventually produce the value of 's': $ java -jar youdebug.jar -socket 5005 SubStringMonitor.ydb s=test See the user guide about all the other things you can do with YouDebug and how you do it. The download is available from here, and the source code is hosted here.
(Nov 8, 2009)