简体   繁体   English

如何在smartJ中的lib /目录中添加一个jar,并为我的web.xml提供类?

[英]how to add a jar to my lib/ directory in intelliJ and have the classes available for my web.xml?

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. 我尝试了很多组合,每次尝试从lib目录添加jar时,intelliJ都会将路径作为src目录。 I don't know why. 我不知道为什么。 When I move the jars to the src/ directory, intelliJ then switches the path to the lib/ directory. 当我将jar移动到src /目录时,intelliJ然后将路径切换到lib /目录。 I am not sure how to get this to work correctly. 我不知道如何让它正常工作。

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. 我正在使用Intellij IDEA 11.1,尝试将Selenium Standalone Server 2 JAR添加到我的新Java项目中,该项目已经有一个模块。 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. 我无法将.jar添加到项目设置模块(如另一个答案所示), 我可以将它添加到项目或全局库中。 This appears to be the best place for it in Intellij IDEA 11.1. 这似乎是Intellij IDEA 11.1中最佳的地方。

To add the JAR to the project library (individual modules): 要将JAR添加到项目库(单个模块):

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 确保要添加JAR的项目已打开,然后选择: 文件 > 项目结构 > > [ + ](新项目库)> Java > ... / selenium-server-standalone-2.24.1.jar > [选择要将JAR添加到的模块]> 确定

To add the JAR to the global library (so it's used for all projects): 要将JAR添加到全局库(因此它用于所有项目):

File > Project Structure > Global Libraries > [ + ] New Global Library > Java > .../selenium-server-standalone-2.24.1.jar > OK 文件 > 项目结构 > 全局库 > [ + ] 新建全局库 > Java > ... / selenium-server-standalone-2.24.1.jar > 确定

My Selenium project now compiles and runs as expected. 我的Selenium项目现在按预期编译和运行。 (-: ( - :

Project structure -> Modules -> -> Add... -> Library -> Java -> Attach Jar Directories... (for IDEA 10). 项目结构 - >模块 - > - >添加... - >库 - > Java - >附加Jar目录...(适用于IDEA 10)。 Are you doing the same? 你也这样做吗?

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

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