如何将jar文件添加到Classpath? [英] How do I add jar files to the Classpath?
问题描述
我在 Windows
,我在 javac下尝试了
无济于事。还尝试将jar移动到src目录,但java文件仍然无法编译。尝试在脚本中简单导入httpclient。 -classpath
I'm on Windows
and I've tried the -classpath
under javac
to no avail. Also tried moving the jar to the src directory, but java file still won't compile. Trying to do a simple import of httpclient in the script.
import org.apache.http.client.*;
推荐答案
-
安装您的JDK和不管它。 不将.jar文件复制到JDK文件夹中!
Install your JDK and leave it alone. Do not copy .jar files into your JDK folders!
我建议您使用像Eclipse或Netbeans这样的IDE,如果你还没有。
I'd recommend getting an IDE like Eclipse or Netbeans, if you don't already have one.
我会设置一个新项目,创建或导入你的源代码,并为项目设置一个类路径。
I would set up a new project, create or import your source, and set a class path for the project.
如果这不起作用,请告诉我们:
If that doesn't work, please tell us:
a)您的操作系统和版本
a) your OS and version
b)你的JDK和版本
b) your JDK and version
c)你的IDE
d)剪切/粘贴EXACT错误消息
d) cut/paste the EXACT error message
e)剪切/粘贴相关代码
e) cut/paste the relevant code
这篇关于如何将jar文件添加到Classpath?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!