How to set classpath to import jar files
Let’s see how to set classpath and why there is a need to set the classpath.
Suppose you are working on a java project using notepad or without using any IDE than to make the additional necessary jar files available to your project, you need to set each jar file by giving full path of the jar file in the classpath.
You can define your all the jar file once and no need to give classpath every time you start command prompt, this can be done as follows:
Right click on my computer > properties > advanced system settings >Environment variables >
Click on “New” below user variables.
Variable name: classpath
Variable value: specify complete path like C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar;.
Now you will see a new variable with name classpath and in value the specified path of jar file with name
If you want to add another jar, for this click edit > add semicolon <;> then the path of other jars.