This tutorial offers step-by-step instructions on how to set up the class path. I will use selenium-java-client-driver.jar and junit-4.5.jar as examples to show you how to add them to the CLASSPATH.
- Depending on the version of your MS Windows, the steps below may be different but similar.
- If you are using MS Windows XP, then open [Classic View]Control Panel->System->Advanced->Environment Variables.
- If you are using MS Windows Vista, then open [Classic View] Control Panel->System->Advanced system settings->Advanced->Environment Variables.
- Under the User variables for X(e.g. Administrator) section, search for the CLASSPATH variable. If the CLASSPATH variable is not listed, then create it. Otherwise, edit it.
- If you have to edit it, then select it. Click on the Edit button and append the following line to the Variable value input field:
Note: There is a semicolon(;) in front and the path may be different in your case depending on the location of your selenium-java-client-driver.jar file. The semicolon(;) is used to separated multiple paths. For example, if you want to also add JUnit's jar file to the CLASSPATH, you have to append the following line to the Variable value input field:
- If you have to create it, then click on the New button. Set the Variable name to CLASSPATH and then set the Variable value to
Note: To add multiple paths, use the semicolon(;) as separator. For example, if you want to also add JUnit's jar file to the CLASSPATH, then set the Variable value input field to
- Click on the OK buttons.
- Open a new Command Prompt for the change to take effect and then execute the following command:
It should return the paths of your jar files(i.e. paths of selenium-java-client-driver.jar and junit-4.5.jar).