It should work if you use the correct syntax and the export command in .bash_profile. Like
Often environmental variables in code that is installed the old-fashioned way ( ./configure, make,.. ) are set in scripts that run during the installation process. You have to worry that some script is re-setting the value of an environmental variable and un-doing what you did in .bash_profile. Environmental variables can be set in /etc/profile and by the scripts in /etc/profile.d also.
"Never let the task you are trying to accomplish distract you from the study of computers."