In this study, a data mining technique and a genetic algorithm are applied to an automatic course scheduling system to produce course timetables that best suit students' and teachers' needs. Course scheduling in colleges and universities is a highly complicated task for satisfying multiple constraints. Conventional course scheduling is done mainly from the school's point of view, such that courses and timetables are planned according to the characteristics of individual departments and institutes, with little attention to students' interests and their needs in career development. This study develops a practical automatic course scheduling system based on students' needs, wherein the course scheduling process is divided into two stages. In the first stage, students' needs in course selection are considered and an association among courses selected by students is mined using the association mining technique; while in the second stage, the genetic algorithm is used to arrange the course timetable. More particularly, this study is based on students' willingness in course selection, analyzes the effects of course arrangement in different class periods on students' learning performance, takes into account teachers' preferred schedules, determines the cost function value of each class period, and then applies the genetic algorithm for class period exchange, so as to produce an optimal course timetable. It is shown in the experiment results that the automatic course scheduling system proposed in this study not only can efficiently replace the onerous operation of conventional manual course scheduling, but also produce course timetables that truly fulfill users' needs and increase students' and teachers' satisfaction, thereby providing a win-win-win solution for students, teachers and the school.