Visual Studio Code, Java Extension, howto add jar to classpathSetting the classpath in a Visual Studio Code Maven-based Java projectVisual Studio Java Language Support add jarIncluding all the jars in a directory within the Java classpathCan I add jars to maven 2 build classpath without installing them?How to avoid Java code in JSP files?How to add local jar files to a Maven project?Multiple cursors in Visual Studio CodeVertical rulers in Visual Studio Code?How do you format code in Visual Studio Code (VSCode)How do I collapse sections of code in Visual Studio Code for Windows?Why is executing Java code in comments with certain Unicode characters allowed?Visual Studio code external jars and tomcat jars to classpath

Why Is Death Allowed In the Matrix?

Problem of parity - Can we draw a closed path made up of 20 line segments...

Why do I get two different answers for this counting problem?

To string or not to string

Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?

Why was the small council so happy for Tyrion to become the Master of Coin?

How to format long polynomial?

How to write a macro that is braces sensitive?

How old can references or sources in a thesis be?

Is it tax fraud for an individual to declare non-taxable revenue as taxable income? (US tax laws)

Example of a continuous function that don't have a continuous extension

Are the number of citations and number of published articles the most important criteria for a tenure promotion?

Test if tikzmark exists on same page

The Two and the One

Modeling an IPv4 Address

Risk of getting Chronic Wasting Disease (CWD) in the United States?

What is the word for reserving something for yourself before others do?

Animated Series: Alien black spider robot crashes on Earth

Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?

Why do falling prices hurt debtors?

What does it mean to describe someone as a butt steak?

Email Account under attack (really) - anything I can do?

How do we improve the relationship with a client software team that performs poorly and is becoming less collaborative?

TGV timetables / schedules?



Visual Studio Code, Java Extension, howto add jar to classpath


Setting the classpath in a Visual Studio Code Maven-based Java projectVisual Studio Java Language Support add jarIncluding all the jars in a directory within the Java classpathCan I add jars to maven 2 build classpath without installing them?How to avoid Java code in JSP files?How to add local jar files to a Maven project?Multiple cursors in Visual Studio CodeVertical rulers in Visual Studio Code?How do you format code in Visual Studio Code (VSCode)How do I collapse sections of code in Visual Studio Code for Windows?Why is executing Java code in comments with certain Unicode characters allowed?Visual Studio code external jars and tomcat jars to classpath






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








11















In Eclipse, I add a jar library using



project -> build path ->configure build path



What is the equivalent in VisualStudioCode? I had a look into launch.json. There is a classpath defined. Adding jars to this classpath (array) variable seems to have no effect.



Essentially, this is a duplicate question of
Visual Studio Java Language Support add jar
But that question is unanswered.



This is such an extremely basic question, that I really don't understand not to find a solution for it in Microsoft's documentation or via Google search.










share|improve this question






















  • visual studio code is a text editor its not an ide so your system variables(if you are on windows) will have class path for your java and other libraries

    – Shubh Dixit
    May 8 '18 at 11:33











  • Start here, I haven't read it completely but you can find useful info code.visualstudio.com/docs/java/java-tutorial

    – Victor Herasme Perez
    May 8 '18 at 11:34











  • This is not a duplicate since the question was about Visual Studio, not Visual Studio Code

    – C.Champagne
    May 8 '18 at 11:34











  • Thanks for this hint. I tried to do: export CLASSPATH=<list of jar files>, then started visual studio code with this environment variable, but the problems stays the same: build fails.

    – gqp21
    May 8 '18 at 11:44












  • I am not sure that vscode is really adapted for Java development but anyway this will depend on which extension you will install to develop in Java. What have you installed??? Furthermore, whatever the one you chose, I suggest you to use Maven or Gradle to manage you dependencies.

    – C.Champagne
    May 8 '18 at 11:48

















11















In Eclipse, I add a jar library using



project -> build path ->configure build path



What is the equivalent in VisualStudioCode? I had a look into launch.json. There is a classpath defined. Adding jars to this classpath (array) variable seems to have no effect.



Essentially, this is a duplicate question of
Visual Studio Java Language Support add jar
But that question is unanswered.



This is such an extremely basic question, that I really don't understand not to find a solution for it in Microsoft's documentation or via Google search.










share|improve this question






















  • visual studio code is a text editor its not an ide so your system variables(if you are on windows) will have class path for your java and other libraries

    – Shubh Dixit
    May 8 '18 at 11:33











  • Start here, I haven't read it completely but you can find useful info code.visualstudio.com/docs/java/java-tutorial

    – Victor Herasme Perez
    May 8 '18 at 11:34











  • This is not a duplicate since the question was about Visual Studio, not Visual Studio Code

    – C.Champagne
    May 8 '18 at 11:34











  • Thanks for this hint. I tried to do: export CLASSPATH=<list of jar files>, then started visual studio code with this environment variable, but the problems stays the same: build fails.

    – gqp21
    May 8 '18 at 11:44












  • I am not sure that vscode is really adapted for Java development but anyway this will depend on which extension you will install to develop in Java. What have you installed??? Furthermore, whatever the one you chose, I suggest you to use Maven or Gradle to manage you dependencies.

    – C.Champagne
    May 8 '18 at 11:48













11












11








11


3






In Eclipse, I add a jar library using



project -> build path ->configure build path



What is the equivalent in VisualStudioCode? I had a look into launch.json. There is a classpath defined. Adding jars to this classpath (array) variable seems to have no effect.



Essentially, this is a duplicate question of
Visual Studio Java Language Support add jar
But that question is unanswered.



This is such an extremely basic question, that I really don't understand not to find a solution for it in Microsoft's documentation or via Google search.










share|improve this question














In Eclipse, I add a jar library using



project -> build path ->configure build path



What is the equivalent in VisualStudioCode? I had a look into launch.json. There is a classpath defined. Adding jars to this classpath (array) variable seems to have no effect.



Essentially, this is a duplicate question of
Visual Studio Java Language Support add jar
But that question is unanswered.



This is such an extremely basic question, that I really don't understand not to find a solution for it in Microsoft's documentation or via Google search.







java visual-studio-code






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 8 '18 at 11:30









gqp21gqp21

5613




5613












  • visual studio code is a text editor its not an ide so your system variables(if you are on windows) will have class path for your java and other libraries

    – Shubh Dixit
    May 8 '18 at 11:33











  • Start here, I haven't read it completely but you can find useful info code.visualstudio.com/docs/java/java-tutorial

    – Victor Herasme Perez
    May 8 '18 at 11:34











  • This is not a duplicate since the question was about Visual Studio, not Visual Studio Code

    – C.Champagne
    May 8 '18 at 11:34











  • Thanks for this hint. I tried to do: export CLASSPATH=<list of jar files>, then started visual studio code with this environment variable, but the problems stays the same: build fails.

    – gqp21
    May 8 '18 at 11:44












  • I am not sure that vscode is really adapted for Java development but anyway this will depend on which extension you will install to develop in Java. What have you installed??? Furthermore, whatever the one you chose, I suggest you to use Maven or Gradle to manage you dependencies.

    – C.Champagne
    May 8 '18 at 11:48

















  • visual studio code is a text editor its not an ide so your system variables(if you are on windows) will have class path for your java and other libraries

    – Shubh Dixit
    May 8 '18 at 11:33











  • Start here, I haven't read it completely but you can find useful info code.visualstudio.com/docs/java/java-tutorial

    – Victor Herasme Perez
    May 8 '18 at 11:34











  • This is not a duplicate since the question was about Visual Studio, not Visual Studio Code

    – C.Champagne
    May 8 '18 at 11:34











  • Thanks for this hint. I tried to do: export CLASSPATH=<list of jar files>, then started visual studio code with this environment variable, but the problems stays the same: build fails.

    – gqp21
    May 8 '18 at 11:44












  • I am not sure that vscode is really adapted for Java development but anyway this will depend on which extension you will install to develop in Java. What have you installed??? Furthermore, whatever the one you chose, I suggest you to use Maven or Gradle to manage you dependencies.

    – C.Champagne
    May 8 '18 at 11:48
















visual studio code is a text editor its not an ide so your system variables(if you are on windows) will have class path for your java and other libraries

– Shubh Dixit
May 8 '18 at 11:33





visual studio code is a text editor its not an ide so your system variables(if you are on windows) will have class path for your java and other libraries

– Shubh Dixit
May 8 '18 at 11:33













Start here, I haven't read it completely but you can find useful info code.visualstudio.com/docs/java/java-tutorial

– Victor Herasme Perez
May 8 '18 at 11:34





Start here, I haven't read it completely but you can find useful info code.visualstudio.com/docs/java/java-tutorial

– Victor Herasme Perez
May 8 '18 at 11:34













This is not a duplicate since the question was about Visual Studio, not Visual Studio Code

– C.Champagne
May 8 '18 at 11:34





This is not a duplicate since the question was about Visual Studio, not Visual Studio Code

– C.Champagne
May 8 '18 at 11:34













Thanks for this hint. I tried to do: export CLASSPATH=<list of jar files>, then started visual studio code with this environment variable, but the problems stays the same: build fails.

– gqp21
May 8 '18 at 11:44






Thanks for this hint. I tried to do: export CLASSPATH=<list of jar files>, then started visual studio code with this environment variable, but the problems stays the same: build fails.

– gqp21
May 8 '18 at 11:44














I am not sure that vscode is really adapted for Java development but anyway this will depend on which extension you will install to develop in Java. What have you installed??? Furthermore, whatever the one you chose, I suggest you to use Maven or Gradle to manage you dependencies.

– C.Champagne
May 8 '18 at 11:48





I am not sure that vscode is really adapted for Java development but anyway this will depend on which extension you will install to develop in Java. What have you installed??? Furthermore, whatever the one you chose, I suggest you to use Maven or Gradle to manage you dependencies.

– C.Champagne
May 8 '18 at 11:48












2 Answers
2






active

oldest

votes


















0














A terrible solution, but for me it works.
(Assuming maven is installed).



Locate your maven repository directory, for me it is:



/Users/username/.m2/repository



Then create the path required following the package name.
If you don't know the package name you can rename the .jar to a .zip and extract the content.



Also create a version number, if you don't have one then make one up.
Here is a example of a structure that I created for byte-buddy-agent since that does not have a maven snippet.



Having done that you edit pom.xml and add something among the lines of:



<dependency>
<groupId>net.bytebuddyagent</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>1.9.8</version>
</dependency>


Save the file, reload the changes, and you should be good to go.
A bunch of files should be created in the directory.



enter image description here






share|improve this answer






























    0














    VSCode works fine with maven or gradle. But without those, as far as I know they have not provided any direct way to add jar file in classpath.



    The workaround is to add the entry in .classpath file manually.



    For e.g. in below file I have added common-logging-1.2.jar manually.



    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="output" path="bin"/>
    <classpathentry exported="true" kind="lib" path="lib/commons-logging-1.2.jar"/>
    </classpath>





    share|improve this answer























    • Created github.com/Microsoft/vscode-java-pack/issues/94 for fixing it

      – Hemang
      Feb 5 at 13:21











    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50232557%2fvisual-studio-code-java-extension-howto-add-jar-to-classpath%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    A terrible solution, but for me it works.
    (Assuming maven is installed).



    Locate your maven repository directory, for me it is:



    /Users/username/.m2/repository



    Then create the path required following the package name.
    If you don't know the package name you can rename the .jar to a .zip and extract the content.



    Also create a version number, if you don't have one then make one up.
    Here is a example of a structure that I created for byte-buddy-agent since that does not have a maven snippet.



    Having done that you edit pom.xml and add something among the lines of:



    <dependency>
    <groupId>net.bytebuddyagent</groupId>
    <artifactId>byte-buddy-agent</artifactId>
    <version>1.9.8</version>
    </dependency>


    Save the file, reload the changes, and you should be good to go.
    A bunch of files should be created in the directory.



    enter image description here






    share|improve this answer



























      0














      A terrible solution, but for me it works.
      (Assuming maven is installed).



      Locate your maven repository directory, for me it is:



      /Users/username/.m2/repository



      Then create the path required following the package name.
      If you don't know the package name you can rename the .jar to a .zip and extract the content.



      Also create a version number, if you don't have one then make one up.
      Here is a example of a structure that I created for byte-buddy-agent since that does not have a maven snippet.



      Having done that you edit pom.xml and add something among the lines of:



      <dependency>
      <groupId>net.bytebuddyagent</groupId>
      <artifactId>byte-buddy-agent</artifactId>
      <version>1.9.8</version>
      </dependency>


      Save the file, reload the changes, and you should be good to go.
      A bunch of files should be created in the directory.



      enter image description here






      share|improve this answer

























        0












        0








        0







        A terrible solution, but for me it works.
        (Assuming maven is installed).



        Locate your maven repository directory, for me it is:



        /Users/username/.m2/repository



        Then create the path required following the package name.
        If you don't know the package name you can rename the .jar to a .zip and extract the content.



        Also create a version number, if you don't have one then make one up.
        Here is a example of a structure that I created for byte-buddy-agent since that does not have a maven snippet.



        Having done that you edit pom.xml and add something among the lines of:



        <dependency>
        <groupId>net.bytebuddyagent</groupId>
        <artifactId>byte-buddy-agent</artifactId>
        <version>1.9.8</version>
        </dependency>


        Save the file, reload the changes, and you should be good to go.
        A bunch of files should be created in the directory.



        enter image description here






        share|improve this answer













        A terrible solution, but for me it works.
        (Assuming maven is installed).



        Locate your maven repository directory, for me it is:



        /Users/username/.m2/repository



        Then create the path required following the package name.
        If you don't know the package name you can rename the .jar to a .zip and extract the content.



        Also create a version number, if you don't have one then make one up.
        Here is a example of a structure that I created for byte-buddy-agent since that does not have a maven snippet.



        Having done that you edit pom.xml and add something among the lines of:



        <dependency>
        <groupId>net.bytebuddyagent</groupId>
        <artifactId>byte-buddy-agent</artifactId>
        <version>1.9.8</version>
        </dependency>


        Save the file, reload the changes, and you should be good to go.
        A bunch of files should be created in the directory.



        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 28 at 20:08









        clankill3rclankill3r

        3,023125190




        3,023125190























            0














            VSCode works fine with maven or gradle. But without those, as far as I know they have not provided any direct way to add jar file in classpath.



            The workaround is to add the entry in .classpath file manually.



            For e.g. in below file I have added common-logging-1.2.jar manually.



            <?xml version="1.0" encoding="UTF-8"?>
            <classpath>
            <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
            <classpathentry kind="src" path="src"/>
            <classpathentry kind="output" path="bin"/>
            <classpathentry exported="true" kind="lib" path="lib/commons-logging-1.2.jar"/>
            </classpath>





            share|improve this answer























            • Created github.com/Microsoft/vscode-java-pack/issues/94 for fixing it

              – Hemang
              Feb 5 at 13:21















            0














            VSCode works fine with maven or gradle. But without those, as far as I know they have not provided any direct way to add jar file in classpath.



            The workaround is to add the entry in .classpath file manually.



            For e.g. in below file I have added common-logging-1.2.jar manually.



            <?xml version="1.0" encoding="UTF-8"?>
            <classpath>
            <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
            <classpathentry kind="src" path="src"/>
            <classpathentry kind="output" path="bin"/>
            <classpathentry exported="true" kind="lib" path="lib/commons-logging-1.2.jar"/>
            </classpath>





            share|improve this answer























            • Created github.com/Microsoft/vscode-java-pack/issues/94 for fixing it

              – Hemang
              Feb 5 at 13:21













            0












            0








            0







            VSCode works fine with maven or gradle. But without those, as far as I know they have not provided any direct way to add jar file in classpath.



            The workaround is to add the entry in .classpath file manually.



            For e.g. in below file I have added common-logging-1.2.jar manually.



            <?xml version="1.0" encoding="UTF-8"?>
            <classpath>
            <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
            <classpathentry kind="src" path="src"/>
            <classpathentry kind="output" path="bin"/>
            <classpathentry exported="true" kind="lib" path="lib/commons-logging-1.2.jar"/>
            </classpath>





            share|improve this answer













            VSCode works fine with maven or gradle. But without those, as far as I know they have not provided any direct way to add jar file in classpath.



            The workaround is to add the entry in .classpath file manually.



            For e.g. in below file I have added common-logging-1.2.jar manually.



            <?xml version="1.0" encoding="UTF-8"?>
            <classpath>
            <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
            <classpathentry kind="src" path="src"/>
            <classpathentry kind="output" path="bin"/>
            <classpathentry exported="true" kind="lib" path="lib/commons-logging-1.2.jar"/>
            </classpath>






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Feb 5 at 13:16









            HemangHemang

            80110




            80110












            • Created github.com/Microsoft/vscode-java-pack/issues/94 for fixing it

              – Hemang
              Feb 5 at 13:21

















            • Created github.com/Microsoft/vscode-java-pack/issues/94 for fixing it

              – Hemang
              Feb 5 at 13:21
















            Created github.com/Microsoft/vscode-java-pack/issues/94 for fixing it

            – Hemang
            Feb 5 at 13:21





            Created github.com/Microsoft/vscode-java-pack/issues/94 for fixing it

            – Hemang
            Feb 5 at 13:21

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50232557%2fvisual-studio-code-java-extension-howto-add-jar-to-classpath%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

            Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

            2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived