Java extension: Failed to get sources. Instead, stub sources have been generated by the disassembler.
See original GitHub issueWhile editing my Java code, I am not getting the Javadocs from JDK’s source code whenever I hover an element or do a [CTRL]+[LEFT CLICK]. Instead, I am getting code generated by a disassembler.
// Failed to get sources. Instead, stub sources have been generated by the disassembler.
// Implementation of methods is unavailable.
The source file is there at:
"D:\Program Files\Java\jdk-17.0.1\lib\src.zip"
Environment
- Operating System: Windows 11
- JDK version: openjdk version “17.0.1” 2021-10-19 OpenJDK Runtime Environment (build 17.0.1+12-39) OpenJDK 64-Bit Server VM (build 17.0.1+12-39, mixed mode, sharing)
- Visual Studio Code version: 1.63.2
- Java extension version: Language Support for Java™ by Red Hat v1.2.0
Steps To Reproduce
- Create a simple java application.
- Hover a method like System.out.print() to see its Javadocs.
- While holding the CONTROL key, LEFT-CLICK the String class source code.
Current Result
- While hovering the method you will see generic information like
void java.io.PrintStream.println(String arg0)
- When CONTROL+RIGHT-CLICKING to open the source code you will see a decompiled version instead of the JDK’s documented source code.

Expected Result
- While hovering the method you should see information like

- When CONTROL+RIGHT-CLICKING to open the source code you should see the JDK’s documented source code.

Additional Informations
Issue Analytics
- State:
- Created 2 years ago
- Comments:9
Top Results From Across the Web
java - Maven dependency : Failed to get sources. Instead, stub ...
Instead, stub sources have been generated by the disassembler. // Implementation of methods is unavailable. I don't have the issue with Java ...
Read more >vscode code navigation "Failed to get sources." - Ask Ubuntu
Failed to get sources. Instead, stub sources have been generated by the disassembler. // Implementation of methods is unavailable. package ...
Read more >Maven : Failed to get sources. Instead, stub sources have ...
When I open a maven dependency, I get a .class file beginning with… ... Instead, stub sources have been generated by the disassembler....
Read more >Navigate and edit Java Source Code in Visual Studio Code
Navigate and edit Java source code. Visual Studio Code is a source code editor first and foremost with rich editing features. In this...
Read more >How to Use Visual Studio Code with Java? - Baeldung
Microsoft improved a lot the developer experience to configure their editor for Java. · If we want to create a new Java project,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I solved it by configuring the same path as JAVA_HOME in the “java.jdt.ls.java.home” config, from the settings.json file.
My JAVA_HOME:
settings.json config:
After configuring settings.json like @joaotesch suggested, I needed to clean the workspace cache with the command:
Java: Clean Java Language Server Workspace