Rock inscriptions on Java dating from the 5th or 6th century tell of Taruma, an extensive Javanese kingdom that was centered near present day Jakarta. The people of Taruma observed Hindu religious rites of India and promoted irrigation works. By the beginning of the 7th century Java was home to several important kingdoms, and a harbor kingdom was also apparently well established on the southeastern coast of Sumatra. The kingdoms of this time fell into two main types of political unit: the seafaring trading states along the coasts of Sumatra, northern Java, Borneo, Sulawesi, and some of the other eastern islands; and the rice-based inland kingdoms, particularly of eastern and central Java. The greatest maritime empire was Sri Vijaya, a Mahayana Buddhist kingdom on Sumatra’s southeast coast. In the late 7th century Sri Vijaya was a center of trade with India and China and for the next five centuries controlled much of China’s trade with the western archipelago. Little archaeological evidence of the Kingdom of Sri Vijaya remains on Sumatra.
In contrast, the Hindu-Buddhist kingdoms of central and eastern Java left extensive temples, buildings, and inscriptions. These monuments and artifacts show Indian culture had vast influence on the religion and state organizations of the Javan kingdoms. The central and eastern kingdoms relied on rice agriculture and had a complex hierarchy headed by a god-king. Inscriptions reveal that under the Sanjaya family the Hindu kingdom of Mataram flourished on the Dieng Plateau in the early 8th century. In the second half of the 8th century a new Buddhist kingdom under the Sailendra dynasty developed in the nearby Kedu Plain; Mataram declined as the Sailendra kingdom rose. The Sailendras built the massive temple monument of Borobudur in the mid-9th century.
Also by the mid-9th century, rulers claiming descent from King Sanjaya (ruled 732-778) of central Java founded a new kingdom of Mataram, whose rule extended from central to eastern Java. In the early 10th century, for unknown reasons, the kingdom’s center shifted to the east, where Hindu influence on the state weakened. First under Sindok (ruled 929-947) and later under Airlangga (ruled 1019-1042), who united the eastern kingdom with Bali, Mataram became increasingly interested in overseas trade. A period of division followed, after which the new kingdom of Singosari was founded on Java in 1222. Its founder and first ruler was Angrok, a commoner. Under the Buddhist king Kertanagara (ruled 1268-1292), Singosari controlled many of the Sumatran areas formerly ruled by Sri Vijaya. Kertanagara’s successor, Vijaya (ruled 1293-1309), repelled a Mongol invasion of Java and in 1293 founded Majapahit, the greatest Javanese empire. Majapahit, under Hayam Wuruk, claimed sovereignty over much of what is now Indonesia and Singapore and parts of Malaysia.