File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Useful Debug Tools? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Useful Debug Tools?" Watch "Useful Debug Tools?" New topic

Useful Debug Tools?

nico dotti
Ranch Hand

Joined: Oct 09, 2007
Posts: 124
I've been avoiding using an IDE while studying for this, and I've been mainly using Vim and command line (well I have a script that allows me to compile and run from vim) I've played with jdb to do some basic debugging. I'd like to find some tools (and documentation to get me going quickly) that I can test out certain basic concepts that are relevant to the exam. For example, it would be nice to be able to play around with creating various Strings via String s = new String, = "some string" str1 = str 2, etc., and then somehow do a heap dump to see how many strings actually got created.

I've briefly seen jhat, jconsole, but have just perused the 'man-like' docs on them. Are these my best choices? Better alternatives?

At one point I was using NetBeans a couple of months ago, and it just had too much of a footprint for me (kept bogging down the system). Haven't tried Eclipse but it looks a little heavier than what I'd like. For the type of exam this is, it seems to me that avoiding make files and autobuilds is a good idea at this point. So I guess my question is there a lightweight IDE that will allow for heap dumps, or a why to set it up myself. Since I'm close to the test date I don't want to take up a whole study day deploying it. LMK ranchers-thanks.
nico dotti
Ranch Hand

Joined: Oct 09, 2007
Posts: 124
Hmm, maybe I don't want a full heap dump - I just ran the jhat along with hprof (which dumps the heap to a file). It's WAY more info than I need. I see lots of data and I don't think I'm going to have time to learn how to read the output from this tool (though it's quite cool and worked quit painlessly)

I just did a test using javap and that seems to get me the info I'm looking for. To share:

It seems to show that when you use the 'new' that in fact a new String is created as you'd expect, as well as the constant being loaded!

That came right after the line that showed it made a new String. So it made the new String AND loaded it into the constant pool (making two objects, right?)

Sorry for the verbosity of my message, I figure if someone else is searching for this it may be useful (I hate when people figure stuff out and don't share just saying 'Oh, I figured it out')
[ December 04, 2007: Message edited by: nico dotti ]
It is sorta covered in the JavaRanch Style Guide.
subject: Useful Debug Tools?
jQuery in Action, 3rd edition