late 14c., "righteous in the eyes of God; upright, equitable, impartial; justifiable, reasonable," from Old French juste "just, righteous; sincere" (12c.), from Latin iustus "upright, equitable," from ius "right," especially "legal right, law," from Old Latin ious, perhaps literally "sacred formula," a word peculiar to Latin (not general Italic) that originated in the religious cults, from PIE root *yewes- "law" (cf. Avestan yaozda- "make ritually pure;" see jurist). The more mundane Latin law-word lex covered specific laws as opposed to the body of laws. The noun meaning "righteous person or persons" is from late 14c.
"merely, barely," 1660s, from Middle English sense of "exactly, precisely, punctually" (c.1400), from just (adj.), and paralleling the adverbial use of French juste. Just-so story first attested 1902 in Kipling, from the expression just so "exactly that, in that very way" (1751).