0

I have simple java programme like below :

import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * @author 
 *
 */
public class IteratorRemoveTest {

/**
 * @param args
 */
public static void main(String[] args) {
    // TODO Auto-generated method stub

    List<String> l = new CopyOnWriteArrayList<>();

    l.add("a");//Line 11

}

}

I have set breakpoint at line 11 and want to debug into the add method by pressing the F5 or step into button available in the eclipse.

Below is the information about setup :

  1. I have source code attached to the eclipse and able to view the source code of the class.
  2. When I set the debug point inside the add method I get the error : Image showing the error message

  3. I have gone through the similar question How can I step into a core java class method in Eclipse? and tried all the ways but could not get the debug into the class file code.

  4. Installed JRE snapshot : Installed JRE

  5. Debug configuration : Debug configuration

Please let me know if any additional information is needed.

Guys, any sort of help/guidance is much appreciated.

Nomade
  • 1,760
  • 2
  • 18
  • 33
Arvind Kumar
  • 459
  • 5
  • 21
  • IntelliJ does this seamlessly, no additional information required. Use a better IDE. – duffymo Feb 15 '18 at 16:19
  • @duffymo Even eclipse does this properly but there is something missing in the configuration that I need to find out and correct that. And FYI Eclipse is also widely used. – Arvind Kumar Feb 15 '18 at 16:24
  • I know, I used to use Eclipse exclusively. Until I was shown IntelliJ. It's a far superior product. – duffymo Feb 15 '18 at 18:18

2 Answers2

1

I try myself and it work for me. One difference is that I am using a java jdk no jre. Possibly jre do not include the source code.

mival
  • 11
  • 4
  • Indeed in the JDK the classes are compiled with line numbers annotated in the code, and in the JRE the compilation does not add them. So use the JDK for development. – Joop Eggen Feb 15 '18 at 16:36
0

Check that the line numbers are turned on in the compiler Classfile configuration Select Window > Preferences and then type 'comp' in the filter. Select Java > Complier and check the highlighted checkbox

:

Classfile configuration

GrahamA
  • 5,875
  • 29
  • 39