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

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 17:41:45

问题


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.


回答1:


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. (-:




回答2:


Project structure -> Modules -> -> Add... -> Library -> Java -> Attach Jar Directories... (for IDEA 10). Are you doing the same?



来源:https://stackoverflow.com/questions/5533428/how-to-add-a-jar-to-my-lib-directory-in-intellij-and-have-the-classes-available

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!