From Surabaya

Surabaya is Indonesia's second city and the eastern anchor of the Java network. It has two stations that are not interchangeable: Gubeng serves the southern line west through Madiun to Solo, Yogyakarta and Bandung, while Pasarturi handles the northern coastal line to Semarang and Jakarta. Getting this wrong means crossing the city. Gubeng is also the busier of the two for short hops: the Sancaka and a string of long-distance trains reach Solo in around four hours, so you rarely wait long. From Surabaya you can also reach Malang in the highlands, Probolinggo for Mount Bromo, Jember in around four hours on the Probowangi or the Jakarta-bound Pandalungan trains, and Banyuwangi, where the station sits beside the ferry terminal for Bali. Some through trains to the east, including the Pandalungan and the Blambangan Ekspres, call at both Pasarturi and Gubeng, so check which station your ticket shows.