英文:
Trying to add external Jars to a Java Project (without Maven)
问题
以下是您要的翻译内容:
我正在尝试将外部 JAR 包添加到我的 Java 项目(无需 Maven)。但是我根本无法使其工作。
官方文档:https://code.visualstudio.com/docs/java/java-project
表示有两种方法可以实现:
- "您可以使用 Java 依赖查看器将任何 JAR 文件添加到您的项目中。"
https://code.visualstudio.com/assets/docs/java/java-project/manage-dependencies.gif
正如您在 GIF 中所看到的,开发者打开了一个名为 "referenced libraries" 的文件夹。
但是在我的情况下,这个文件夹并不存在。
或者 2. "将其他附加的 JAR 文件作为依赖项带入的另一种简便方法是在独立文件的根目录中创建一个 lib/ 文件夹,并将您的 JAR 文件放在那里。如果在 lib/ 文件夹中存在 foo-sources.jar,那么 foo.jar 的源代码将会自动被检测到。"
https://code.visualstudio.com/docs/java/java-project/lib.mp4
我已经将 JAR 文件放在 lib\ 文件夹中,但仍然显示相同的错误消息。
我是否遗漏了任何步骤?
英文:
I am trying to add external jars to my Java (without Maven) Project.
But I don't get it to work at all.
The official documentation: 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."
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.
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."
https://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.
Are there any steps I am missing?
答案1
得分: 1
依照指示,将外部 JAR 文件放置在 ...\JAVArpg\lib
文件夹中。
因此,从您目前存放它们的位置进行复制。cp ../lib/*.jar lib/
只是一个示例。
您可以使用 Windows 资源管理器。您无需使用命令行复制文件。
英文:
As it says, place the external jar files in the ...\JAVArpg\lib
folder.
So copy them from wherever you have them now. cp ../lib/*.jar lib/
is just an example.
You can use the Windows Explorer. You don't have to copy the files using a command-line.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论