Import .jar in Visual Studio Code, classpath

后端 未结 2 1933
温柔的废话
温柔的废话 2021-01-15 00:29

I am using Visual Studio Code to Write a Java Project. For that i want to use the MigLayout.jar in my Project.

I created a new Project so i would get a .classpath

相关标签:
2条回答
  • 2021-01-15 00:52

    1.make sure you hava create a folder named lib inside your project and add your .jar file into it

    2.Configure paths in the .classpath like:

    <classpathentry kind="lib" path="lib/miglayout.jar"/>
    

    3.if it still thow error,Clean the workspace directory:F1 - input Clean -clean workspace

    you could look at the doucument add jar

    0 讨论(0)
  • 2021-01-15 01:09

    I set up a gradle project and added the dependency via the link from https://mvnrepository.com/

    I copied the given commands on the MigLayout Site behind the "Gradle" tab and put them into the dependencies{} in the build.grade file

    With ./gradlew run from the command line out of the project folder it compiled successfully. Thanks for the help anyways.

    PS: I still haven't figured out how to do it without gradle. Even compiling from the command line with: javac -cp "path to jar" myFile i did not get the dependencies right. Let me know if you have experience with that.

    0 讨论(0)
提交回复
热议问题