0

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.

skaffman
  • 398,947
  • 96
  • 818
  • 769
shree
  • 125
  • 1
  • 4
  • 15

2 Answers2

1

Just adding the directory containing the JAR files isn't enough. Add the specific JAR file to the classpath instead, e.g.

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?

Community
  • 1
  • 1
skaffman
  • 398,947
  • 96
  • 818
  • 769
0
  • check that package org.apache.commons.net.ntp.* presents in jar file
  • make sure that the jar file is in the class path of an application How to set Classpath
Hemant Metalia
  • 29,730
  • 18
  • 72
  • 91