It's smart to get an assessment by a medical professional in cases where you have pain. However, it's also good to do basic maintenance on yourself.
If you want to do some troubleshooting on your own, take a look at this article by Mike Robertson on knee pain. (I've linked to the first part; make sure to read all three.)
To summarize what he says, as the articles are somewhat lengthy (but very worthwhile), in many cases knee pain is not caused by anything wrong with the knee but by some other issue above or below the knee. For example, tight hip flexors can cause an imbalance in the thigh that results in knee pain. This is something that's been a problem for me because I work from a chair all day.
Mike has some great recommendations on how to correct common problems like this. Another worthwhile resource is Kelly Starret's MobilityWOD (Workout of the Day). I've been doing these exercises for a bit and have seen some real improvement in my knee pain. Start at the beginning.
These exercises are generally safe if you don't have any other specific problems that your doctor has pointed out. (As always, consult with your physician and stop if something is really painful.)