Out of James II's reign came the law barring Catholics from the English monarchy. James tried to restore Catholicism to Britain, but the people just wouldn't stand for it; too many had died in religious conflicts. He appointed Catholic friends to high-ranking positions and alienated members of Parliament.
Fearing the worst, James packed up and fled England. That left England without a king and essentially without a government. An emergency session of Parliament was convened to deal with the crisis. Parliament declared James's daughter Mary and her husband, William of Orange, as co-rulers.
In 1689, Parliament made it illegal for any English monarch to practice Catholicism or even marry a Catholic. On accession the monarch must make a declaration before Parliament rejecting Catholicism:
...whereas it hath beene found...inconsistent with the safety and welfaire of this protestant kingdome to be governed by a popish prince or by any King or Queene marrying a papist...it may be enacted that all and every person and persons that is are or shall be reconciled to or shall hold communion with the see or church of Rome or shall professe the popish religion or shall marry a papist shall be excluded and be for ever uncapeable to inherit possesse or enjoy the crowne and government of this realme and Ireland and the dominions thereunto belonging or any part of the same or to have use or exercise any regall power authoritie or jurisdiction within the same.
James II (1633-1701) Lord Admiral of the Navy, British king who converted to Catholicism in 1672 in order to marry Mary of Modena. Anti-Catholic feeling running high, Parliament responded by passing the Test Act, which forbid Catholics from holding public office and forced James from his, whereupon he vacated Britain and lived in exile a number of years. Eventually Charles II recalled him back to the admiral's office. James became king in 1685, and attempted to reintegrate Catholics into British political and military offices, going to the extreme measure of dissolving Parliament when it didn't conform to his wishes. Protestant nobles within Britain countered by negotiating with William of Orange to become king; James, losing his support, eventually fled Britain again. Since the transition of power occurred without bloodshed, it was termed the "Glorious Revolution," and affirmed that, at least in Britain, the legislative body of government (Parliament) was supreme over the executive (king.) After he was deposed, he became religious, living in France until his death.
Encyclopedia Britannica, 11th ed., vol. 15, pg. 138.
First of all he wasn't executed, but self-exilled,in France, because of his views and conversion to Catholic religion, his friendly policies to France and his antiparliamentarian feelings, which attracted the hate of Whig party.
He was sheltered by Louis XIV, in France and, in September 1701, he died.