Where should I put an external JAR file in my Eclipse project?

落爺英雄遲暮 提交于 2020-01-21 15:27:27

问题


I've created a new project in Eclipse and I want to include the ANTLR jar file.

Where do you typically place your jar files before referencing them in your project? Do you create a "Source Directory" in eclipse, or a normal "Directory"? Do you then reference them from there?

I want to be able to easily transport this project around and not declare references to jar files outside my projects folder but I'm not sure what the normal convention is to do in the Java world.

Any guidance would be appreciated.


回答1:


I usually create a /lib directory in which I place all 3rd party JARs. Then I tell Eclipse to add all those JARs to my compile and runtime CLASSPATH. I believe it's right click on "project", choose "Build Path > Libraries" (per Balus-C), and then modify CLASSPATH. Sorry I'm not more specific, but I don't use Eclipse. I prefer IntelliJ, but the idea is the same for all Java IDEs.



来源:https://stackoverflow.com/questions/2126019/where-should-i-put-an-external-jar-file-in-my-eclipse-project

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