question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Java extension: Failed to get sources. Instead, stub sources have been generated by the disassembler.

See original GitHub issue

While 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
  1. Create a simple java application.
  2. Hover a method like System.out.print() to see its Javadocs.
  3. While holding the CONTROL key, LEFT-CLICK the String class source code.
Current Result
  1. While hovering the method you will see generic information like void java.io.PrintStream.println(String arg0) image
  2. When CONTROL+RIGHT-CLICKING to open the source code you will see a decompiled version instead of the JDK’s documented source code. image
Expected Result
  1. While hovering the method you should see information like
    image
  2. When CONTROL+RIGHT-CLICKING to open the source code you should see the JDK’s documented source code. image
Additional Informations

VS Code console.txt vscode-app-1641621696309.log

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9

github_iconTop GitHub Comments

30reactions
joaoteschcommented, Feb 2, 2022

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: image

settings.json config: image

5reactions
GustavoASCcommented, May 25, 2022

After configuring settings.json like @joaotesch suggested, I needed to clean the workspace cache with the command:

Java: Clean Java Language Server Workspace

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found