简体   繁体   English

尝试将外部 Jars 添加到 Java 项目(没有 Maven)

[英]Trying to add external Jars to a Java Project (without Maven)

I am trying to add external jars to my Java (without Maven) Project.我正在尝试将外部 jars 添加到我的 Java(没有 Maven)项目中。
But I don't get it to work at all.但我根本不让它工作。 The official documentation: https://code.visualstudio.com/docs/java/java-project官方文档: https://code.visualstudio.com/docs/java/java-project
says there are 2 ways to do it:说有两种方法可以做到:
1."You can use the Java Dependency Viewer to add any JAR file to your project." 1.“您可以使用 Java 依赖项查看器将任何 JAR 文件添加到您的项目中。” https://code.visualstudio.com/assets/docs/java/java-project/manage-dependencies.gif https://code.visualstudio.com/assets/docs/java/java-project/manage-dependencies.gif
As you can seee in the gif, the dev opens a "referenced libraries" folder.正如您在 gif 中看到的,开发人员打开了一个“引用的库”文件夹。
This folder DOES NOT EXIST for me.这个文件夹对我来说不存在。
or 2."The other easy way to bring additional JAR files as dependencies is to create a lib/ folder in the root directory of the standalone files and place your JAR files there. Source for foo.jar is automatically detected if there is a foo-sources.jar in the lib/ folder."或 2.“将额外的 JAR 文件作为依赖项的另一种简单方法是在独立文件的根目录中创建一个 lib/ 文件夹,并将 JAR 文件放在那里。如果 foo.Z68995FCBF432492D15484D0 存在 afoo.Z68995FCBF432492D15484D0AC,则自动检测到源-sources.jar 在 lib/ 文件夹中。”
https://code.visualstudio.com/docs/java/java-project/lib.mp4https://code.visualstudio.com/docs/java/java-project/lib.mp4

I have the Jar file in the lib\ folder but it still shows me he same error messages.我在 lib\ 文件夹中有 Jar 文件,但它仍然向我显示相同的错误消息。 Are there any steps I am missing?有没有我遗漏的步骤?

As it says, place the external jar files in the ...\JAVArpg\lib folder.正如它所说,将外部 jar 文件放在...\JAVArpg\lib文件夹中。

So copy them from wherever you have them now.因此,从您现在拥有它们的任何地方复制它们。 cp../lib/*.jar lib/ is just an example . cp../lib/*.jar lib/只是一个例子

You can use the Windows Explorer.您可以使用 Windows 资源管理器。 You don't have to copy the files using a command-line.您不必使用命令行复制文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM