James may not have expected to become King, as his older brother King Charles II would have hoped for legitimate male heirs to inherit the throne.
Sadly for Charles this never happened. James became both King James VII of Scotland and King James II of England. However he was deposed from both thrones by his daughter Mary and her husband William of Orange. James fled to France, and after failing to reclaim his two kingdoms he ultimately retired in exile there.