The Taruma and Sunda kingdoms of western Java appeared in the 4th and 7th centuries respectively, while the Kalingga Kingdom sent embassies to China starting in 640.
However, the first major principality was the Medang Kingdom that was founded in central Java at the beginning of the 8th century.
Medang's religion centred on the Hindu god Shiva, and the kingdom produced some of Java's earliest Hindu temples on the Dieng Plateau.
Around the 8th century the Sailendra dynasty rose in Kedu Plain and become the patron of Mahayana Buddhism.
This ancient kingdom built monuments such as the 9th century Borobudur and Prambanan in central Java.

Around the 10th century the centre of power shifted from central to eastern Java.
The eastern Javanese kingdoms of Kediri, Singhasari and Majapahit were mainly dependent on rice agriculture, yet also pursued trade within the Indonesian archipelago, and with China and India.

Majapahit was established by Wijaya and by the end of the reign of Hayam Wuruk (r. 1350–89) it claimed sovereignty over the entire Indonesian archipelago, although control was likely limited to Java, Bali and Madura.
Hayam Wuruk's prime minister, Gajah Mada, led many of the kingdom's territorial conquests.
Previous Javanese kingdoms had their power based in agriculture, however, Majapahit took control of ports and shipping lanes and became Java's first commercial empire.
With the death of Hayam Wuruk and the coming of Islam to Indonesia, Majapahit went into decline.
The Taruma and Sunda kingdoms of western Java appeared in the 4th and 7th centuries respectively, while the Kalingga Kingdom sent embassies to China starting in 640. However, the first major principality was the Medang Kingdom that was founded in central Java at the beginning of the 8th century. Medang's religion centred on the Hindu god Shiva, and the kingdom produced some of Java's earliest Hindu temples on the Dieng Plateau. Around the 8th century the Sailendra dynasty rose in Kedu Plain and become the patron of Mahayana Buddhism. This ancient kingdom built monuments such as the 9th century Borobudur and Prambanan in central Java.
Around the 10th century the centre of power shifted from central to eastern Java. The eastern Javanese kingdoms of Kediri, Singhasari and Majapahit were mainly dependent on rice agriculture, yet also pursued trade within the Indonesian archipelago, and with China and India.
Majapahit was established by Wijaya and by the end of the reign of Hayam Wuruk (r. 1350–89) it claimed sovereignty over the entire Indonesian archipelago, although control was likely limited to Java, Bali and Madura. Hayam Wuruk's prime minister, Gajah Mada, led many of the kingdom's territorial conquests. Previous Javanese kingdoms had their power based in agriculture, however, Majapahit took control of ports and shipping lanes and became Java's first commercial empire. With the death of Hayam Wuruk and the coming of Islam to Indonesia, Majapahit went into decline.
Java