The classes inside rt.jar (as shipped by Oracle) were built without the -g flag (to make the download smaller). That is a good idea, until you try to debug swing code (inside eclipse, for instance) and realize that variable names are not available. A quick solution for this problem is to build the classes yourself, using the -g flag. Here is how (using win7 + cygwin and I assume the content of JAVA_HOME is the JDK installation path):
cd ~
mkdir src
cd src
mkdir classes
cp %JAVA_HOME%/src.zip .
cp %JAVA_HOME%/jre/lib/rt.jar .
unzip src.zip
find -name *.java > files.txt
javac @options.txt @files.txt 2>&1 | grep “.*[A-Z].*\.java:[0-9]*: [^w]“
cd classes
jar cvf debug.jar *
Now, here is the content for options.txt (put this file in ~src/):
-d classes
-g
-verbose
-J
-Xmx512m
-cp rt.jar
-nowarn
-source 1.6
-Xlint:none
After you are done, you can copy the jar file to your eclipse project, and under Debug Configurations > Classpath tab > Bootstrap Entries add debug.jar on top of JRE system.
References found during the research for this post are here