was only to be attained by not making it the direct end. Those only are happy (I thought) who have their minds fixed on some object other than their own happiness...aiming thus at something else, they find happiness along the way...ask yourself whether you are happy, and you cease to be so. The only chance is to treat, not happiness, but some end external to it, as the purpose of life. (Mill, pp. 117-118)
Mill, and many other philosophers (Sidgwick and Aristotle, arguably), have insisted that trying to be happy is counterproductive because, they assumed, it is difficult to acquire happiness directly. They advised us to focus on things other than happiness, otherwise, we would be doomed to sadness. Recent studies suggest this thesis might be wrong. Trying to be happy doesn't necessarily obstruct the experience of happiness and trying to be happy, it seems, can enhance our happiness.
Mill, J. S., & Robson, J. M. (1989). Autobiography. London, England: Penguin Books.