Let x km/h be the Jim's speed. If the difference in Jim's and John's speeds is 2 km/h, then the John's speed is x+2 km/h.
1. John takes 15 minutes to walk with speed x+2 km/h from school to the bus station, then the distance is 15·(x+2) km.
2. Jim takes 20 minutes to walk with speed x km/h from school to the bus station, then the distance is 20·x km.
3. The distance is the same, so
20x=15(x+2),
20x=15x+30,
20x-15x=30,
5x=30,
x=30:5,
x=6.
Answer: the distance between the station and the school is 6 km.