The conventional leg extension exercise has taken a bad rap in recent years. The criticism centers around the fact that they don't really stimulate the muscles in the same manner as with running or walking.
The truth is that the leg extension is very good for isolating and strengthening the vastus medialis-the muscle located slightly to the inside that is responsible for extending the leg. A weak vastus medialis can contribute to knee pain so it makes perfectly good sense to use leg extensions. Just be careful not to use too much weight, don't let the knee flex more than 90 degrees, and don't throw the weight to the top and then lock it out at the top. Use a slower controlled motion and don't hold it at the lock-out postion for more than a brief second. You can also experiment with pointing your toes at different angles to find the most comfortable position.
As with any exercise, if it hurts stop! Here is a good video from mayoclinic.com that demonstrates proper technique.