It depends on the JVM (the running Java environment) used.
If you run it as a Java Application from the commandline, use the environment variable $CLASSPATH. If you run it as a JAR file, then define it in the manifest.mf. If you run it in an IDE, then put the external JARs in the root of the project and/or define it in the "build path" of the project properties. If you run it as an webapplication in an application server, then put the external JARs in the WEB-INF/lib or in the application server /lib directory.