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

后端 未结 8 901
攒了一身酷
攒了一身酷 2020-11-29 03:20

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

8条回答
  •  长情又很酷
    2020-11-29 04:02

    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:

    
      net.bytebuddyagent
      byte-buddy-agent
      1.9.8
    
    

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

提交回复
热议问题