late 14c., "morally upright, righteous in the eyes of God" ("Now chiefly as a Biblical archaism" - OED); also "equitable, fair, impartial in one's dealings;" also "fitting, proper, conforming to standards or rules;" also "justifiable, reasonable;" from Old French juste "just, righteous; sincere" (12c.) and directly from Latin iustus "upright, righteous, equitable; in accordance with law, lawful; true, proper; perfect, complete" (source also of Spanish and Portuguese justo, Italian giusto), from ius "a right," especially "legal right, law" (see jurist; from Latin ius also come English jury (n.), injury, etc.).
From c. 1400 as "right-minded, good in intention;" from early 15c. as "legal, lawful, right in law." Also "exact, precise; marked or characterized by precision; having correct dimensions" (late 14c.); of narrations, calculations, etc., "accurate, correct" (early 15c.). The sense in music, "harmonically pure, correct, and exact" is by 1850.
The more mundane Latin law-word lex covered specific laws as opposed to the body of laws. The noun meaning "righteous person or persons; Christ" is from late 14c. (The neuter adjective in Latin was used as a noun, iustum, "what is right or just").
"retaliation for wrongs real or fancied, act of doing harm or injury in return for wrong or injury suffered," 1540s, from French revenge, a back-formation from revengier (see revenge (v.)). Hence "vindictive feeling, desire to be revenged."