Early Javanese Kingdoms

The island's exceptional fertility allowed the development of an intensive sawah (wet rice) agriculture, which in turn required close cooperation between villages. Out of village alliances, small kingdoms developed, including that of King Purnawarman of Taruma, but the first major principality was that of King Sanjaya, who founded the Mataram Kingdom at the beginnning of the 8th century. Mataram's religion centred of Hindu god Shivam and pproduced some Java's earliest Hindu temple on the Dieng Plateau. The Syailendra Dynasty followed, over seeing Buddism's heyday and the building of Borobudur, but Hinduism and Buddism continued to coexist and the massive Hindu Prambanan complex was constructed within a century of Borobudur.
Mataram eventually fell, perhaps at the hands of Sumatra based Sriwijaya Kingdom, which invaded Java in the 11th century. However, Javanese power began its revival in 1019 under King Airlangga, a semi-legendary figure who formed the first royal link between the island and Bali. Despite his role as a unifier, Airlangga later spit the kindom between his two sons, creating Jenggala to the east and Kediri to the west.
It was only a matter of time before the balance of power was to change once again. Early in 13th century commoner Ken Arok usurped the throne of Singasari (apart of Jenggala Kingdom) defeated Kediri and brought Jenggala under his control. The new kingdom ended in 1292 with the murder of its last king, Kertanegara but in its short 70n years Javanese culture flourished and some of the island's most stinking thempels were built,
Shivasism and new religion Shiva - Buddhism, which is still worshipped in Java and Bali today.