vscode code navigation “Failed to get sources.”

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
0
down vote

favorite
1












I am using VSCODE to develop codes in Java with "Java Extension Pack". I encountered the issue that the code navigation of vscode doesn't work as expected.



Previously, I can use "Ctrl+Click"(please see the description: https://code.visualstudio.com/docs/editor/editingevolved) to check the definitions from Java packages, such as java.util.HashMap etc.



However, after re-install my OS, the code navigation didn't work as expected. Unlike some posts online(please see https://github.com/Microsoft/vscode-go/issues/966 or https://github.com/Microsoft/vscode-cpptools/issues/756), in my case, it works but it shows .class file with such comments on the top of the file. Let me use the Hashmap as the example.



/* HashMap.class */



// Failed to get sources. Instead, stub sources have been generated by the disassembler.
// Implementation of methods is unavailable.
package java.util;
public class HashMap<K,V> extends java.util.AbstractMap implements java.util.Map, java.lang.Cloneable, java.io.Serializable
// many declartions for methods below
...



What I need is navigating to the HashMap.java rather than HashMap.class.
I use "Setting Sync" extension which restores all my previous settings, so I don't think there are any issues about my setting. I still will provide some related User settings below



 "java.classPath": ,

// Specifies the folder path to the JDK (8 or more recent) used to launch the Java Language Server.
"java.home": null,

// Installation directory of Java 8
"java.home": "",

// Traces the communication between VS Code and the Java language server.
"java.trace.server": "off",


More info:



OS: Ubuntu 18.04 LTS



VSCODE version: 1.22.2



openjdk version "1.8.0_162"



Any help will be appreciated! Thank yoU!







share|improve this question
























    up vote
    0
    down vote

    favorite
    1












    I am using VSCODE to develop codes in Java with "Java Extension Pack". I encountered the issue that the code navigation of vscode doesn't work as expected.



    Previously, I can use "Ctrl+Click"(please see the description: https://code.visualstudio.com/docs/editor/editingevolved) to check the definitions from Java packages, such as java.util.HashMap etc.



    However, after re-install my OS, the code navigation didn't work as expected. Unlike some posts online(please see https://github.com/Microsoft/vscode-go/issues/966 or https://github.com/Microsoft/vscode-cpptools/issues/756), in my case, it works but it shows .class file with such comments on the top of the file. Let me use the Hashmap as the example.



    /* HashMap.class */



    // Failed to get sources. Instead, stub sources have been generated by the disassembler.
    // Implementation of methods is unavailable.
    package java.util;
    public class HashMap<K,V> extends java.util.AbstractMap implements java.util.Map, java.lang.Cloneable, java.io.Serializable
    // many declartions for methods below
    ...



    What I need is navigating to the HashMap.java rather than HashMap.class.
    I use "Setting Sync" extension which restores all my previous settings, so I don't think there are any issues about my setting. I still will provide some related User settings below



     "java.classPath": ,

    // Specifies the folder path to the JDK (8 or more recent) used to launch the Java Language Server.
    "java.home": null,

    // Installation directory of Java 8
    "java.home": "",

    // Traces the communication between VS Code and the Java language server.
    "java.trace.server": "off",


    More info:



    OS: Ubuntu 18.04 LTS



    VSCODE version: 1.22.2



    openjdk version "1.8.0_162"



    Any help will be appreciated! Thank yoU!







    share|improve this question






















      up vote
      0
      down vote

      favorite
      1









      up vote
      0
      down vote

      favorite
      1






      1





      I am using VSCODE to develop codes in Java with "Java Extension Pack". I encountered the issue that the code navigation of vscode doesn't work as expected.



      Previously, I can use "Ctrl+Click"(please see the description: https://code.visualstudio.com/docs/editor/editingevolved) to check the definitions from Java packages, such as java.util.HashMap etc.



      However, after re-install my OS, the code navigation didn't work as expected. Unlike some posts online(please see https://github.com/Microsoft/vscode-go/issues/966 or https://github.com/Microsoft/vscode-cpptools/issues/756), in my case, it works but it shows .class file with such comments on the top of the file. Let me use the Hashmap as the example.



      /* HashMap.class */



      // Failed to get sources. Instead, stub sources have been generated by the disassembler.
      // Implementation of methods is unavailable.
      package java.util;
      public class HashMap<K,V> extends java.util.AbstractMap implements java.util.Map, java.lang.Cloneable, java.io.Serializable
      // many declartions for methods below
      ...



      What I need is navigating to the HashMap.java rather than HashMap.class.
      I use "Setting Sync" extension which restores all my previous settings, so I don't think there are any issues about my setting. I still will provide some related User settings below



       "java.classPath": ,

      // Specifies the folder path to the JDK (8 or more recent) used to launch the Java Language Server.
      "java.home": null,

      // Installation directory of Java 8
      "java.home": "",

      // Traces the communication between VS Code and the Java language server.
      "java.trace.server": "off",


      More info:



      OS: Ubuntu 18.04 LTS



      VSCODE version: 1.22.2



      openjdk version "1.8.0_162"



      Any help will be appreciated! Thank yoU!







      share|improve this question












      I am using VSCODE to develop codes in Java with "Java Extension Pack". I encountered the issue that the code navigation of vscode doesn't work as expected.



      Previously, I can use "Ctrl+Click"(please see the description: https://code.visualstudio.com/docs/editor/editingevolved) to check the definitions from Java packages, such as java.util.HashMap etc.



      However, after re-install my OS, the code navigation didn't work as expected. Unlike some posts online(please see https://github.com/Microsoft/vscode-go/issues/966 or https://github.com/Microsoft/vscode-cpptools/issues/756), in my case, it works but it shows .class file with such comments on the top of the file. Let me use the Hashmap as the example.



      /* HashMap.class */



      // Failed to get sources. Instead, stub sources have been generated by the disassembler.
      // Implementation of methods is unavailable.
      package java.util;
      public class HashMap<K,V> extends java.util.AbstractMap implements java.util.Map, java.lang.Cloneable, java.io.Serializable
      // many declartions for methods below
      ...



      What I need is navigating to the HashMap.java rather than HashMap.class.
      I use "Setting Sync" extension which restores all my previous settings, so I don't think there are any issues about my setting. I still will provide some related User settings below



       "java.classPath": ,

      // Specifies the folder path to the JDK (8 or more recent) used to launch the Java Language Server.
      "java.home": null,

      // Installation directory of Java 8
      "java.home": "",

      // Traces the communication between VS Code and the Java language server.
      "java.trace.server": "off",


      More info:



      OS: Ubuntu 18.04 LTS



      VSCODE version: 1.22.2



      openjdk version "1.8.0_162"



      Any help will be appreciated! Thank yoU!









      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 26 at 23:52









      Xin Chen

      153




      153




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          I had the same error, except with a source jar in my local repository rather than HashMap.



          I fixed it by quitting Visual Studio Code, removing all the .classpath, .factorypath, and .project files (my project has submodules so there are multiple of these), then reopening VS Code and letting it find everything again.



          There's likely a more elegant way to do this but brute force worked.






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "89"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1028571%2fvscode-code-navigation-failed-to-get-sources%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            I had the same error, except with a source jar in my local repository rather than HashMap.



            I fixed it by quitting Visual Studio Code, removing all the .classpath, .factorypath, and .project files (my project has submodules so there are multiple of these), then reopening VS Code and letting it find everything again.



            There's likely a more elegant way to do this but brute force worked.






            share|improve this answer
























              up vote
              0
              down vote













              I had the same error, except with a source jar in my local repository rather than HashMap.



              I fixed it by quitting Visual Studio Code, removing all the .classpath, .factorypath, and .project files (my project has submodules so there are multiple of these), then reopening VS Code and letting it find everything again.



              There's likely a more elegant way to do this but brute force worked.






              share|improve this answer






















                up vote
                0
                down vote










                up vote
                0
                down vote









                I had the same error, except with a source jar in my local repository rather than HashMap.



                I fixed it by quitting Visual Studio Code, removing all the .classpath, .factorypath, and .project files (my project has submodules so there are multiple of these), then reopening VS Code and letting it find everything again.



                There's likely a more elegant way to do this but brute force worked.






                share|improve this answer












                I had the same error, except with a source jar in my local repository rather than HashMap.



                I fixed it by quitting Visual Studio Code, removing all the .classpath, .factorypath, and .project files (my project has submodules so there are multiple of these), then reopening VS Code and letting it find everything again.



                There's likely a more elegant way to do this but brute force worked.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jun 21 at 20:35









                Nathan Walther

                1




                1



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1028571%2fvscode-code-navigation-failed-to-get-sources%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    pylint3 and pip3 broken

                    Missing snmpget and snmpwalk

                    How to enroll fingerprints to Ubuntu 17.10 with VFS491