It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened,
visit the help center.
Closed 7 years ago.
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.*;
The -classpath
command line argument (to both java
and javac
) expect that you will list specific JAR files (and/or "exploded" directories containing class files). This is unlike the Windows/UNIX PATH
environment variable which just lists directories containing executables.
So for example, if you want to compile com.example.Foo
that depends on lib/bar.jar
you might use the following incantation:
javac -classpath lib/bar.jar com/example/Foo.java
But my guess is that you are also getting a specific error message, and knowing that error message would be useful in helping you further.