如何将 jar 添加到 intelliJ 中的 lib/ 目录并让类可用于我的 web.xml?
我尝试了许多组合,每次尝试从Lib目录中添加罐子时,Intellij都将路径降低为SRC目录。我不知道为什么。当我将罐子移至SRC/ Directory时,Intellij然后将路径切换到LIB/ Directory。我不确定如何使其正常工作。
I have tried many combinations and every time I try to add the jars from the lib directory, intelliJ puts the path down as the src directory. I don't know why. When I move the jars to the src/ directory, intelliJ then switches the path to the lib/ directory. I am not sure how to get this to work correctly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我正在使用 Intellij IDEA 11.1,尝试将 Selenium Standalone Server 2 JAR 添加到我的新 Java 项目中,该项目已经有一个模块。我无法将 .jar 添加到项目设置模块(如另一个答案中的建议),但是我可以将其添加到项目或全局库中。这似乎是 Intellij IDEA 11.1 中最适合它的地方。
要将 JAR 添加到项目库(单个模块):
确保要添加 JAR 的项目已打开,然后选择:文件 > 项目结构 > 图书馆> [+](新项目库)> Java > > .../selenium-server-standalone-2.24.1.jar > > [选择要添加 JAR 的模块] > 确定
将 JAR 添加到全局库(以便它用于所有项目):
文件 > 项目结构 > 全球图书馆 > [+] 新全局库 > Java > > .../selenium-server-standalone-2.24.1.jar > > 确定
我的 Selenium 项目现在可以按预期编译和运行。 (-:
I'm using Intellij IDEA 11.1, trying to add the Selenium Standalone Server 2 JAR to my new Java project, which already has a module. I could not add the .jar to the Project settings Module (as suggested in another answer), but I can add it to either the project or global libraries. This appears to be the best place for it in Intellij IDEA 11.1.
To add the JAR to the project library (individual modules):
Ensure that the project to which you want the JAR added is open, then choose: File > Project Structure > Libraries > [+] (New Project Library) > Java > .../selenium-server-standalone-2.24.1.jar > [Select the module to add the JAR to] > OK
To add the JAR to the global library (so it's used for all projects):
File > Project Structure > Global Libraries > [+] New Global Library > Java > .../selenium-server-standalone-2.24.1.jar > OK
My Selenium project now compiles and runs as expected. (-:
项目结构->模块-> ->添加...->图书馆-> Java->附加 Jar 目录...(适用于 IDEA 10)。你也在做同样的事吗?
Project structure -> Modules -> -> Add... -> Library -> Java -> Attach Jar Directories... (for IDEA 10). Are you doing the same?