In the final chapter of his treatise, Mill addresses the relationship between utilitarianism and justice. It is helpful in understanding this chapter to have a working framework of why Mill feels this issue needs to be addressed in the first place.
Mill states it is important to discuss the relationship between utility and justice because of people's intuitions about justice. Specifically, people tend to believe that justice is a moral standard that inheres to the natural world. Given such an account of justice, one could have difficulty reconciling this apparent a priori moral mandate with utilitarian considerations.
Mill's initial critique of this perception of justice follows in the same vein as his discussion of standards of moral proof. He says that the origin of sentiments of justice and the feeling that we are compelled to act in certain ways have no bearing on the relation of justice to our overall moral theory. Determinations of moral theory require an appeal to our faculties of reason in rationally analyzing and parsing out the various competing elements of what would constitute an accurate and coherent moral system.
Having said as much, Mill approaches the question of utility and justice in this chapter in two main parts. First, he endeavors to tease out the various elements of what in composite we understand as justice. As stated above, he is less interested in a complete ontology than in providing a believable framework from which the reader can determine whether or not basic interests of justice operate in concert or in opposition to utilitarian concerns. Thereafter, he offers a more detailed analysis of how he sees utilitarianism relating to justice.
The first part of Mill's survey of justice is a lengthy overview of different forms justice is known to take, which he considers in order to extract considerations that are fundamental to all and, therefore, fundamental to justice. Forms he maintains justice takes are: legal rights; moral rights; just desserts; faith between people; impartiality; and equality. He also undertakes a quick jaunt into philosophy of language in considering the etymological origins of justice as a word.
The upshot of Mill's long survey is that justice's mandate is concerned with societal harmony and maintenance, invoking the principle of expediency insofar as those who breach justice are proportionately punished in a proper setting. More to the point, he sees justice as those moral actions or abstentions to which one can claim a right, which separates it from other types of moral considerations such as expediency. Thus the mandate of justice is essentially in the sense that we are bound to behave or not behave in certain ways towards others.
In his final analysis of justice, Mill parses the sentiment into two more foundational sentiments: sympathy and self-defense. Mill does not pursue the origins of sympathy here, but lets it suffice to point out that humans are separate from other creatures in being able to empathize with people who are not related to them as kin, which allows them to feel sentiments of justice or injustice towards actions exacted upon others as though those actions were exacted upon themselves. Self-defense is what Mill is more concerned with, for he sees this as the basis for societal order and the common ground between justice and expediency.
The first place to push Mill here is on whether or not the issue he is aiming to resolve in this chapter is actually an issue. That justice is a quality that inheres to external reality is not an obvious position in modern times. If we assert that justice is merely a societal construct, it appears that the objection to utilitarianism Mill is anticipating is actually a non-starter.
But suppose the issue is valid. We must give Mill credit for surveying a wide set of issues seen as pertaining to justice. The conclusion he draws that justice consists of sympathy and self-defense seems plausible and sufficient for his purposes. In particular, Mill is able through theory to get to our initial intuition about the issue: justice as a concept is designed for the maintenance and harmony of society.
Note the Mill does not delve particularly deep into the matter of sympathy in relation to justice, as it is outside the scope of his line of reasoning. As a reader, it would be useful if interested in this chapter to read Adam Smith's The Theory of Moral Sentiments. As Smith's entire moral theory is founded on the principle of sympathy, the ontology that Mill alludes to is described there is great detail. It is clear from what little Mill says on the matter of sympathy that his views of justice were influenced by Smith.
Note also Mill's emphasis on justice as a sentiment towards non-kin relations. This, of course, is paramount to morality because it allows different families to interact harmoniously in society. It also raises an interesting line of reasoning about the ontology of morality and justice in relation to kin and evolution.
To briefly consider a broad body of literature, there exists a notion that morality was selected evolutionarily first as a means to help kin survive, thereby improving the likelihood of one's genes at least partly being passed on. From there, the sentiments expanded to improve general societal survival rates by people caring about and protecting non-kin in accordance with moral norms. While not directly related to Mill's argument, it can be helpful to consider the anatomy of morality in relation to its ontology.