You must be a commissioned officer to be a USAF pilot. There are 3 primary routes to becomming a USAF officer: US Air Force Academy, AFROTC, and AFOTS. Each of these includes a 4 year degree.
The requirements to get a Pilot AFSC (job code) do not specify a particular major; however ROTC and OTS give preference to technical majors for admissions into those programs.
The Academy is a 4 year college.
ROTC is a college program.
OTS is completed after graduation.