Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
464 views
in Technique[技术] by (71.8m points)

classpath - 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. 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...