0

I am trying to debug java source code, for this I am using JDK's rt.jar. I am stepping into source code while debuging

ex:-

Map m = new HashMap();      
m.put(10, "abc");

I placed brakepoint for m.put() and stepping into the sourcecode of put() method in HashMap but I am unable to see values for key and value which I am passing. The problem is rt.jar has given without debuginfo for this we have to compile the source code.

I am trying to compile the source code according to this post debug jdk source can't watch variable what it is

But while compiling below line

javac -J-Xms16m -J-Xmx1024m -sourcepath "D:\etr\java\debug\jdk_source" -cp "D:\etr\java\debug\rt.jar" -d "D:\etr\java\debug\jdk_debug" -g @filelist.txt >> log.txt 2>&1

I am getting the below error in log.txt

javac: invalid flag: D:\etr\java\java Usage: javac <options> <source files> use -help for a list of possible options

Can anyone help me how to fix the above issue.

Community
  • 1
  • 1
subbu royal
  • 584
  • 4
  • 12
  • 29
  • Sure you can see the values of the two parameters. Just look at the `Variables` view in the Eclipse Debugger. The parameters are called `arg0` and `arg1`. – Andreas Dec 07 '16 at 06:32
  • Yeah, but I am unable to inspect like `ctrl`+`shit`+`i` I am getting `cannot be resolved type`. is it possible to see the values by inspecting them? @Andreas – subbu royal Dec 07 '16 at 06:36
  • You can see the parameters and the `this` object in the `Variables` view. Isn't that enough, rather than messing with recompiling the JDK? – Andreas Dec 07 '16 at 06:39
  • Why are you trying to 'debug' HashMap? The chances of there being a problem in JDK code are tiny. – greg-449 Dec 07 '16 at 07:35
  • I doing this because to understand the internals of HashMap. @greg-449 – subbu royal Dec 07 '16 at 07:40

0 Answers0