14 There is a thing which is to no purpose done on the earth: that there are good men to whom is given the same punishment as those who are evil, and there are evil men who get the reward of the good. I say that this again is to no purpose. 15 So I gave praise to joy, because there is nothing better for a man to do under the sun than to take meat and drink and be happy; for that will be with him in his work all the days of his life which God gives him under the sun. 16 When I gave my mind to the knowledge of wisdom and to seeing the business which is done on the earth (and there are those whose eyes see not sleep by day or by night), 17 Then I saw all the work of God, and that man may not get knowledge of the work which is done under the sun; because, if a man gives hard work to the search he will not get knowledge, and even if the wise man seems to be coming to the end of his search, still he will be without knowledge.

Matthew Henry's Commentary on Ecclesiastes 8:14-17

Commentary on Ecclesiastes 8:14-17

(Read Ecclesiastes 8:14-17)

Faith alone can establish the heart in this mixed scene, where the righteous often suffer, and the wicked prosper. Solomon commended joy, and holy security of mind, arising from confidence in God, because a man has no better thing under the sun, though a good man has much better things above the sun, than soberly and thankfully to use the things of this life according to his rank. He would not have us try to give a reason for what God does. But, leaving the Lord to clear up all difficulties in his own time, we may cheerfully enjoy the comforts, and bear up under the trials of life; while peace of conscience and joy in the Holy Ghost will abide in us through all outward changes, and when flesh and heart shall fail.