How can I define CLASSPATH variable

Yes, this file doesn't exist by default. The difference between bash_profile or .bashrc versus .profile is that the latter will be read by shells other than bash. For your purposes, you can simply name it .bashrc. Open up Terminal and enter the following command:

cd ~/; touch .bashrc; open -a TextEdit .bashrc

Now you have a created a profile, which the bash shell will read from everytime you log into it.

Next, simply enter the variable as plain text in the document:

export CLASSPATH=/path/to/folder

Or, if your have a current $CLASSPATH that needs to be added to, append the folder to it in your profile:

export CLASSPATH=$CLASSPATH:/path/to/folder

Save the .bashrc file. Exit Terminal and open Terminal back up (or run . ~/.bashrc in Terminal without exit/reopen).

To test, enter:

echo $CLASSPATH