简体   繁体   English

如何在Java中安装httpclient和其他库,以便可以在Eclipse中使用它们?

[英]How can I install httpclient and other libraries in Java so I can use them in Eclipse?

I'm a new Java developer I've only ever done PHP in the past and all the functions I needed to use were built into PHP. 我是一名新的Java开发人员,过去只做过PHP,而我需要使用的所有功能都已内置到PHP中。 This doesn't seem to be the case with Java though! 但是,Java似乎并非如此!

I downloaded Eclipse and wrote a hello world and some other things and everything is working great for me! 我下载了Eclipse并编写了一个hello world和其他一些东西,一切对我来说都很好! I downloaded httpclient (from http://hc.apache.org/downloads.cgi ) and I can see two files, httpclient-4.0.2.jar and httpmime-4.0.2.jar but I'm not sure how I can add them into my program and start using them to build something with! 我下载了httpclient(从http://hc.apache.org/downloads.cgi ),我可以看到两个文件,httpclient-4.0.2.jar和httpmime-4.0.2.jar,但是我不确定该怎么做。将它们添加到我的程序中,并开始使用它们进行构建!

Any help would be appreciated so much and I'm sorry if this comes off as a trolling question of sorts, I'm really new to this! 任何帮助将不胜感激,如果这是一个棘手的问题,我很抱歉,我真的是新来的!

在Eclipse中,在Package Explorer中右键单击您的项目,然后选择Build Path> Add External Archives ...导航到jar文件,选择它们,然后单击Open。

Hi in any environment weather it be eclipse, jdeveloper, intellj, netbeans or commandline you need to add the downloaded jar files to the classpath/libraries. 嗨,在任何环境中,无论是eclipse,jdeveloper,intellj,netbeans还是命令行,您都需要将下载的jar文件添加到类路径/库中。 This is so the JVM know where to look for external libraries. 这样,JVM便知道在哪里寻找外部库。

In Eclipse in the project explorer right click on the root project and go to properties. 在Eclipse中的项目资源管理器中,右键单击根项目并转到属性。 Then in the left hand list go to Java build path, once selected go to libraries then go to add external libraries. 然后在左侧列表中转到Java构建路径,选择后转到库,然后添加外部库。 Once selected they should appear in the list next to the button. 选择后,它们应显示在按钮旁边的列表中。

hope this helps. 希望这可以帮助。

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

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