An effective free energy of a two-dimensional (i.e., large area) Josep
hson junction is derived, allowing for thermal fluctuations, random ma
gnetic fields, and external currents. We show by using replica-symmetr
y-breaking methods that the junction has four distinct phases: disorde
red, Josephson ordered, a glass phase, and the critical a coexisting J
osephson order with the glass phase. Near the coexistence to glass tra
nsition at s = 1/2 the critical current is similar to(area)(- S + 1/2)
where s is a measure of disorder. Our results may account for junctio
n ordering at temperatures well below the critical temperature of the
bulk in high-T-c trilayer junctions.