-2

I am debugging with my code, but the error shows "Source not found." when using line breakpoint. The problem is that I can import java.util.*, but I cannot see the code in it, for example, I want to see the source code of AbstractSet.

I have searched a lot of ways. I am pretty sure any shortcut like ctrl+T+click or anything else didn't work. To avoid duplicated problem, I have tried a lot of ways like How to see the source code for java SDK (java.lang, java.util, ...) classes in Eclipse? However, this way didn't work for me. I have downloaded JDK-13, and it also didn't work. What I need is just to see the code in java.util. Hope anyone helps.

error:

Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 4, Size: 4
    at java.util.ArrayList.rangeCheck(Unknown Source)
    at java.util.ArrayList.remove(Unknown Source) // here is the problem
    at ArrayMap$ArrayMapEntrySetIterator.remove(ArrayMap.java:135)
    at java.util.AbstractMap.remove(Unknown Source)
    at test.main(test.java:22)

@bathudaide Thanks for your reply. For now, I can see the source code by ctrl+click class name. However, I still met error when trying to run my code. source_not_found Please see the image. jdk-687fd7c7986d is what I downloaded from your link. I put it into my previous folder, then it works fine when I ctrl+click class name, but I still met "Unknown Source", which is the same as the error code above.

I have checked this one -> I get "Source not found" when debugging my Java code in Eclipse But it did not work for me.

Lize
  • 1
  • 1
  • Please DO NOT make it duplicated without trying by yourself. Besides, the jre I use is jre1.8.0_181. – Lize Oct 10 '19 at 08:07
  • How about that answer in your linked question? https://stackoverflow.com/a/54263753/2522681 – Michael Lang Oct 10 '19 at 08:24
  • @Michael Lang I didn't have java-util-1.8.0.jar. Besides, the guy who answered that question used jre instead of jdk. I don't think they work in the same way. Most importantly, the questioner hoped to find a way to use java-util-1.8.0.jar. Thus, in my opinion, that answer didn't help me. – Lize Oct 10 '19 at 08:43

1 Answers1

1

1. View on Eclipse

Ctrl + click to Java class and do step by step as below

enter image description here

Result

enter image description here

  1. View online, see on Openjdk
bathudaide
  • 737
  • 1
  • 4
  • 12
  • Thanks, but this is not my problem. Please see my updated images. – Lize Oct 10 '19 at 08:36
  • Great, I can see the source code, but when I used debug, it still shown "Unknown source". I have tried put the downloaded folder in my previous folder, but it failed. Please see the new image. Thanks. – Lize Oct 10 '19 at 09:18