The evidence at our disposal points to the fact that Java received most of its civilization from Hindu colonists, but who were these colonists and from what part of India did they come? We must not think of any sudden and definite conquest, but rather of a continuous current of immigration starting perhaps from several springs and often merely trickling, but occasionally swelling into a flood. Native traditions collected by Raffles[382] ascribe the introduction of Brahmanism and the Śaka era to the sage Tritresta and represent the invaders as coming from Kalinga or from Gujarat.

The difference of locality may be due to the fact that there was a trade route running from Broach to Masulipatam through Tagara (now Ter). People arriving in the Far East by this route might be described as coming either from Kalinga, where they embarked, or from Gujarat, their country of origin. Dubious as is the authority of these legends, they perhaps preserve the facts in outline. The earliest Javanese inscriptions are written in a variety of the Vengi script and the T'ang annals call the island Kaling as well as Java. It is therefore probable that early tradition represented Kalinga as the home of the Hindu invaders. But later immigrants may have come from other parts. Fa-Hsien could find no Buddhists in Java in 418, but Indian forms of Mahayanism indubitably flourished there in later centuries. The Kalasan inscription dated 778 A.D. and engraved in Nâgari characters records the erection of a temple to Târâ and of a Mahayanist monastery. The change in both alphabet and religion suggests the arrival of new influences from another district and the Javanese traditions about Gujarat are said to find an echo among the bards of western India and in such proverbs as, they who go to Java come not back[383]. In the period of the Hunnish and Arab invasions there may have been many motives for emigration from Gujarat. The land route to Kalinga was probably open and the sea route offers no great difficulties[384].

Another indication of connection with north-western India is found in the Chinese work Kao Sêng Chuan (519 A.D.) or Biographies of Eminent Monks, if the country there called Shê-p'o can be identified with Java[385]. It is related that Guṇavarman, son of the king of Kashmir, became a monk and, declining the throne, went first to Ceylon and then to the kingdom of Shê-p'o, which he converted to Buddhism. He died at Nanking in 431 B.C.

Târanâtha[386] states that Indo-China which he calls the Koki country[387], was first evangelized in the time of Asoka and that Mahayanism was introduced there by the disciples of Vasubandhu, who probably died about 360 A.D., so that the activity of his followers would take place in the fifth century. He also says that many clergy from the Koki country were in Madhyadeśa from the time of Dharmapâla (about 800 A.D.) onwards, and these two statements, if they can be accepted, certainly explain the character of Javanese and Cambojan Buddhism. Târanâtha is a confused and untrustworthy writer, but his statement about the disciples of Vasubandhu is confirmed by the fact that Dignâga, who was one of them, is the only authority cited in the Kamahâyânikan[388].

The fact that the terms connected with rice cultivation are Javanese and not loan-words indicates that the island had some indigenous civilization when the Hindus first settled there. Doubtless they often came with military strength, but on the whole as colonists and teachers rather than as conquerors. The Javanese kings of whom we know most appear to have been not members of Hindu dynasties but native princes who had adopted Hindu culture and religion. Sanskrit did not oust Javanese as the language of epigraphy, poetry and even religious literature. Javanese Buddhism appears to have preserved its powers of growth and to have developed some special doctrines. But Indian influence penetrated almost all institutions and is visible even to-day. Its existence is still testified to by the alphabet in use, by such titles as Arjo, Radja, Praboe, Dipati ( = adhipati), and by various superstitions about lucky days and horoscopes. Communal land tenure of the Indian kind still exists and in former times grants of land were given to priests and, as in India, recorded on copper plates. Offerings to old statues are still made and the Tenggerese[389] are not even nominal Mohammedans. The Balinese still profess a species of Hinduism and employ a Hindu Calendar.

From the tenth century onwards the history of Java becomes a little plainer.

Copper plates dating from about 900 A.D. mention Mataram. A certain Mpoe Sindok was vizier of this kingdom in 919, but ten years later we find him an independent king in east Java. He lived at least twenty-five years longer and his possessions included Pasoeroean, Soerabaja and Kediri. His great-grandson, Er-langga (or Langghya), is an important figure. Er-langga's early life was involved in war, but in 1032 he was able to call himself, though perhaps not with great correctness, king of all Java. His memory has not endured among the Javanese but is still honoured in the traditions of Bali and Javanese literature began in his reign or a little earlier. The poem Arjuna-vivâha is dedicated to him, and one book of the old Javanese prose translation of the Mahabharata bears a date equivalent to 996 A.D.[390]

One of the national heroes of Java is Djajabaja[391] who is supposed to have lived in the ninth century. But tradition must be wrong here, for the free poetic rendering of part of the Mahabharata called Bhârata-Yuddha, composed by Mpoe Sĕdah in 1157 A.D., is dedicated to him, and his reign must therefore be placed later than the traditional date. He is said to have founded the kingdom of Daha in Kediri, but his inscriptions merely indicate that he was a worshipper of Vishṇu. Literature and art flourished in east Java at this period for it would seem that the Kawi Ramayana and an ars poetica called Vṛitta-sañcaya[392] were written about 1150 and that the temple of Panataran was built between 1150 and 1175.

In western Java we have an inscription of 1030 found on the river Tjitjatih. It mentions a prince who is styled Lord of the World and native tradition, confirmed by inscriptions, which however give few details, relates that in the twelfth century a kingdom called Padjadjaran was founded in the Soenda country south of Batavia by princes from Toemapĕl in eastern Java.

There is a gap in Javanese history from the reign of Djajabaja till 1222 at which date the Pararaton[393], or Book of the Kings of Toemapĕl and Madjapahit, begins to furnish information. The Sung annals[394] also give some account of the island but it is not clear to what years their description refers. They imply, however, that there was an organized government and that commerce was flourishing. They also state that the inhabitants "pray to the gods and Buddha": that Java was at war with eastern Sumatra: that embassies were sent to China in 992 and 1109 and that in 1129 the Emperor gave the ruler of Java (probably Djajabaja) the title of king.