The experiences of this period had two very marked effects on my opinions and character. In the first place, they led me to adopt a theory of life, very unlike that on which I had before acted, and having much in common with what at that time I certainly had never heard of, the anti-self-consciousness theory of Carlyle. I never, indeed, wavered in the conviction that happiness is the test of all rules of conduct, and the end of life. But I now thought that this end 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; on the happiness of others, on the improvement of mankind, even on some art or pursuit, followed not as a means, but as itself an ideal end. Aiming thus at something else, they find happiness by the way. The enjoyments of life (such was now my theory) are sufficient to make it a pleasant thing, when they are taken en passant, without being made a principal object. Once make them so, and they are immediately felt to be insufficient. They will not bear a scrutinizing examination. 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. Let your self-consciousness, your scrutiny, your self-interrogation, exhaust themselves on that; and if otherwise fortunately circumstanced you will inhale happiness with the air you breathe, without dwelling on it or thinking about it, without either forestalling it in imagination, or putting it to flight by fatal questioning. This theory now became the basis of my philosophy of life. And I still hold to it as the best theory for all those who have but a moderate degree of sensibility and of capacity for enjoyment, that is, for the great majority of mankind.
Note from KBJ: Mill is describing (without naming) the paradox of happiness. Robert Martin defines "happiness paradox" as follows: "It's sometimes supposed that happiness is best achieved by those who do not seek it (but who go after other goals). Thus the pursuit of happiness is self-defeating." Robert M. Martin, The Philosopher's Dictionary, 3d ed. (Peterborough, Ontario: Broadview Press, 2002), 142.
Note 2 from KBJ: Mill was a monistic utilitarian. As he says in this paragraph, he never "wavered in the conviction that happiness is the test of all rules of conduct, and the end of life." Happiness, in Mill's view, is the only thing that is intrinsically good (i.e., good for its own sake, good in and of itself). All other goods, such as love, knowledge, friendship, virtue, and justice, are extrinsically good (i.e., good because they are a part of, or a means to, happiness). Some utilitarians are pluralists rather than monists. They hold that there is more than one thing that is intrinsically good. Incidentally, Mill defined "happiness" as pleasure and the absence of pain. It's not clear why he conflated these two concepts. Perhaps he was giving a precising definition of "happiness," which is vaguer than "pleasure." Because of his emphasis on pleasure, Mill can be thought of (and called) a hedonistic utilitarian.