I downloaded commons-net-3.0.1-bin.zip
file and extracted it to java lib
folder. I have set the path to java bin
folder and classpath=.;C:\\Program Files\\Java\\jdk1.7.0_01\\lib\\commons-net-3.0.1
.
commons-net-3.0.1
folder has commons-net-3.0.1 jar
, commons-net-3.0.1-sources.jar
and commons-net-examples-3.0.1.jar
files.
In my program I imported org.apache.commons.net.ntp.*
package, and it gave the "package doesn't exist" error.
Just adding the directory containing the JAR files isn't enough. Add the specific JAR file to the classpath instead, eg
classpath=.;C:\Program Files\Java\jdk1.7.0_01\lib\commons-net-3.0.1\commons-net-3.0.1.jar
Alternatively, use a classpath wildcard to add all JARs in a given directory. See How to use a wildcard in the classpath to add multiple jars?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.