Verse 22: And Joshua said unto the people, Ye are witnesses against yourselves that (Ps. 119:173) ye have chosen you the LORD, to serve him. And they said, We are witnesses.
[Ye are witnesses] After the Commander-in-Chief thinks that the assembly has deliberated sufficiently, he proceeds further; and he, as God’s treaty-maker, extracts an oath in solemn utterances, etc. (Masius).
Ye are witnesses against yourselves; this solemn profession will be a swift witness against you, if hereafter you apostatize from God.
Verse 23: Now therefore (Josh. 24:14; Gen. 35:2; Judg. 10:16; 1 Sam. 7:3) put away, said he, the strange gods which are among you, and incline your heart unto the LORD God of Israel.
[Remove the strange gods in your midst, הָסִ֛ירוּ אֶת־אֱלֹהֵ֥י הַנֵּכָ֖ר אֲשֶׁ֣ר בְּקִרְבְּכֶ֑ם] Put away the strange gods that are in your midst (Junius and Tremellius). Strange gods, or, rather, gods of a strange, understanding, people; Genesis 35:2. Thus, בְּנֵי נֵכָר, υἱοὶ ἀλλοτριότητος, sons of foreignness, that is, ἀλλότριοι/foreigners (Drusius). The אֲשֶׁר/which/that is twofold, and is able to be referred either, 1. to the strange people that were yet living among them; or, 2. to the gods; which is more apt (Malvenda out of Masius). For in a similar oration that בְּתֹכְכֶם, among you, Moses has interpreted as בְּיָדָם, which were in their hands, Genesis 35:2, 4; which certainly is not able to be understood of barbarian men (Masius). Gods, that is, images that ye have seized from conquered cities, or have carried out of Egypt (Vatablus). Strange gods Augustine here understands of the opinions of men, absurd and foreign to the majesty of God. For it is not plausible, says he, that the images of gods were among them (Augustine in Masius). But he speaks of idols properly so called (Lapide, thus Masius, Bonfrerius). He supposes that the worshippers of idols are yet among them (Bonfrerius), at least covertly and secretly (Masius). Now, this was discovered to him either by revelation, or by arguments morally certain (Bonfrerius). Objection: But we do not here see any images being put away, as was elsewhere done, Genesis 35; etc. Response: No mention is made in the books of Moses of that idolatry of which Amos, Amos 5:26, and Stephen, Acts 7:43, accuse them. And furthermore, when the words here are the same as in Genesis 35, why are they interpreted in so diverse a sense (Masius)? [See more concerning these things on verse 14.]
The strange gods which are among you; those idols which you either brought out of Egypt, or have taken in Canaan, which I have too much reason to believe that some of you, contrary to God’s command, do keep, whether for the preciousness of the matter, or rather for some secret inclination to superstition and idolatry, as the following words imply. See verse 14.
Verse 24: And the people said unto Joshua, The LORD our God will we serve, and his voice will we obey.
Verse 25: So Joshua (see Ex. 15:25; 2 Kings 11:17) made a covenant with the people that day, and set them a statute and an ordinance (Josh. 24:26) in Shechem.
[He cut a covenant] With sacrifices and other rites used, as in Exodus 24:5-8 (Masius). But this is not proven. It is one thing to enter newly into a covenant; it is another thing to renovate a former covenant; which is wont to be done with words and protestations alone (Bonfrerius).
[And he set forth to the people] Hebrew: he set for it (Munster, Pagnine, Tigurinus, Junius and Tremellius); he established for them (Vatablus). That is to say, he set forth to them in a compendium the statues and judgments of the Divine Law (Menichius, similarly the Hebrews in Masius). He set forth to them the precepts, moral and ceremonial: he added nothing to the Law, but he taught them the conditions of this covenant (Vatablus).
Either, 1. He set, or propounded, or declared unto them the statute and ordinance, that is, the sum of the statutes and ordinances of God, which their covenant obliged them to. Or, 2. He set or established it, to wit, that covenant, with them, that is, the people, for a statute or an ordinance, to bind themselves and their posterity unto God for ever, as a statute and ordinance of God doth.
 Hebrew: וַיֹּ֙אמֶר יְהוֹשֻׁ֜עַ אֶל־הָעָ֗ם עֵדִ֤ים אַתֶּם֙ בָּכֶ֔ם כִּֽי־אַתֶּ֞ם בְּחַרְתֶּ֥ם לָכֶ֛ם אֶת־יְהוָ֖ה לַעֲבֹ֣ד אוֹת֑וֹ וַיֹּאמְר֖וּ עֵדִֽים׃
 Hebrew: וְעַתָּ֕ה הָסִ֛ירוּ אֶת־אֱלֹהֵ֥י הַנֵּכָ֖ר אֲשֶׁ֣ר בְּקִרְבְּכֶ֑ם וְהַטּוּ֙ אֶת־לְבַבְכֶ֔ם אֶל־יְהוָ֖ה אֱלֹהֵ֥י יִשְׂרָאֵֽל׃
 Genesis 35:2: “Then Jacob said unto his household, and to all that were with him, Put away the strange gods that are among you (הָסִ֜רוּ אֶת־אֱלֹהֵ֤י הַנֵּכָר֙ אֲשֶׁ֣ר בְּתֹכְכֶ֔ם), and be clean, and change your garments…”
 For example, Nehemiah 9:2: “And the seed of Israel separated themselves from all strangers (בְּנֵ֣י נֵכָ֑ר; υἱοῦ ἀλλοτρίου, in the Septuagint), and stood and confessed their sins, and the iniquities of their fathers.”
 Hebrew: וַיֹּאמְר֥וּ הָעָ֖ם אֶל־יְהוֹשֻׁ֑עַ אֶת־יְהוָ֤ה אֱלֹהֵ֙ינוּ֙ נַעֲבֹ֔ד וּבְקוֹל֖וֹ נִשְׁמָֽע׃
 Hebrew: וַיִּכְרֹ֙ת יְהוֹשֻׁ֧עַ בְּרִ֛ית לָעָ֖ם בַּיּ֣וֹם הַה֑וּא וַיָּ֥שֶׂם ל֛וֹ חֹ֥ק וּמִשְׁפָּ֖ט בִּשְׁכֶֽם׃
 Hebrew: וַיִּכְרֹ֙ת יְהוֹשֻׁ֧עַ בְּרִ֛ית.
 Hebrew: וַיָּ֥שֶׂם ל֛וֹ.