Borut Flis
Borut Flis

Reputation: 16415

Setting classpath in windows

I setup classpath in enviroment variables i set a user variable named classpath with value= .;C:\Users\Borut\Downloads\httpcomponents-client-4.1.2-bin\lib

the directory is full of .jar files. yet still when i run a program through cmd it reports an error that the package from the class does not exist.

Upvotes: 0

Views: 339

Answers (2)

Ernest Friedman-Hill
Ernest Friedman-Hill

Reputation: 81724

Historically, you've needed to include the jar files themselves, not the directory they're in, on the CLASSPATH. In recent JREs, you can use a wildcard (i.e., a path ending in /*) to indicate all the jars in a directory. But if you indicate only a directory, then that directory is searched for class files and packages only; jar files are ignored.

Upvotes: 2

Dave Newton
Dave Newton

Reputation: 160301

You need to either (a) explicitly list the jar files, or (b) use a wildcard classpath (1.6+).

Upvotes: 1

Related Questions