LAFAYETTE, Ind. (MarketWatch) — America’s factories are facing a shortage of skilled workers. And Nic Herrera and Denise Flores are seen as part of the solution.

They’re learning how to program robots and troubleshoot problems on the production line through a two-year work-and-college program run by Vincennes University and four manufacturing companies in Lafayette, Ind.

The program, which is beginning its third year, is part of a changing mindset among factory managers — and a changing workforce. Indiana, the state most dependent on manufacturing, could be short as many as 1 million manufacturing employees by 2025 as longtime workers retire and as employers complain of difficulties in finding new workers with the right skills.

“We realized if we want the workforce of the future, we’re going to have to get our hands in it. We can’t just wait for it to happen,” said Brad Rhorer, who has championed the program as assistant senior manager of human resources at Subaru of Indiana Automotive, owned by Fuji Heavy Industries Ltd. 7270, -1.60% in Japan.

Subaru is one of a handful of companies that have teamed up with Vincennes to create a program that mixes classes and work. In the Lafayette “Advanced Internship in Manufacturing” program, or AIM, students learn by doing, splitting their time between the classroom and the factory floor. They graduate in just over two years with an associate’s degree in computer-integrated manufacturing technology and, most likely, a job offer in maintenance from their factory employer.

Read:Why U.S. companies pay headhunters $15,000 to fill manufacturing jobs

Similar programs are popping up around the country, in what is an American twist on Germany’s much-vaunted apprenticeship program. Vincennes runs similar maintenance-focused programs built around Toyota’s TM, +0.78% Indiana factory, 30 miles south of Vincennes, and a group of smaller companies in Jasper, an hour southeast of Vincennes. All of them, says Donna Taylor Bouchie, who oversees them as director of Vincennes’ InternPlus program, have more applicants than slots. Manufacturers help decide who gets selected.

“ “There is a rather large number of employers saying they want something or need something like this. But it is difficult to get them to organize.” ” — Chuck Johnson, president of Vincennes University

To be sure, the programs on their own won’t solve the worker shortage. The latest group to start the AIM program numbers only 24. Some students are fresh out of high school, and many others have been working for several years. Vincennes is looking for ways to expand the program, Bouchie said.

Recruiting for the next class has already begun. Tom Schott, the AIM program’s coordinator in Lafayette, will visit 30 high schools in a 12-county area.

“There is a rather large number of employers saying they want something or need something like this,” said Chuck Johnson, the president of Vincennes University. “But it is difficult to get them to organize. It takes industry stepping up and making a time commitment and a personnel commitment.”

There’s no guarantee the students will stay in manufacturing. Vincennes officials say the program isn’t aimed at top high-school students considering a four-year engineering degree from Purdue University, in neighboring West Lafayette. “We have discovered there is a difference between an engineer and a person who wants to be the hands-on person on the floor,” Bouchie says.

Instead, the target is someone more like 19-year-old Madison Gish, who admits that “I didn’t really know what I wanted to do after high school.”

She’s now in her second year of the AIM program and finds she enjoys writing the “standard work instructions” that explain how to run or maintain a machine. Still, she says, maintenance really isn’t for her; she’s more of a computer person.

Not only must manufacturers hold on to their newly trained workers, but they also have to convince parents that manufacturing can be a career, not just a job. Many see college, not a factory, as the pathway to success, a message underscored by high schools’ emphasis on getting students into four-year programs.

Read:47% of high school grads aren’t prepared for college

For Gish and others, the Lafayette program actually starts the summer before classes begin. They’re given jobs on the factory floor, working as summer help for as much as $13.50 an hour. That’s designed to give them a feel for what happens on the production line before they head to Vincennes, 150 miles away in southwestern Indiana, for a semester of technology classes plus an online speech class.

Back in Lafayette, they spend three days a week at their paid internship, shadowing experienced maintenance technicians, and two days a week taking more classes for two full years, including summers. Subaru pays them $17.50 an hour; some suppliers that are involved in the program pay less. State training money covers half of the cost. Vincennes says their total earnings of about $30,000 should cover most, if not all, of their tuition and living expenses.

On a recent Friday, students in the second-year program are using their laptops to work through a troubleshooting scenario involving faulty electrical wiring. In the next room, they can practice hanging fuse boxes and making connections. Nearby, a half-dozen gray robotic arms from the Subaru factory are set up. Students will learn to maintain and program those as well.

Not all will survive the program. They’re expected to earn at least a C in every class. They accumulate demerits for tardiness and absenteeism on the job; too many and they’re booted from the program. That’s happened to some, while others decide maintenance work isn’t for them. Seventeen of the 22 who were accepted into the program a year ago are still in it.

Robots now do the welding at Subaru of Indiana Automotive in Lafayette, Ind. Subaru of Indiana Automotive

The program’s roots go back to Subaru, which is facing a retirement crunch. But the problem is particularly acute in the maintenance department, which does everything from repairing a broken wire to writing program logic for a stamping press larger than a three-story home. More than half of the staff of about 200 will be eligible for retirement by 2025, and maintenance has become more complicated as automation has increased. When Subaru opened its Lafayette factory in 1989, for example, almost every weld on a car was done by a person. Today, about 1,500 robots do those jobs. Subaru’s production, meanwhile, has jumped to 1,350 cars a day — one every 63 seconds — from 88 in 1989.

It can take years to fully train a new maintenance worker, says Rhorer, Subaru’s assistant senior manager of human resources. That’s worrying, given that every minute of unplanned down time on the production line costs the company $10,000.

“The need for maintenance is so vast across the state that we have to have other ways to fill those positions,” he says.

Read:America desperately needs to redefine ‘college and career ready’

So in 2014, Subaru took on 10 students as the first class of AIM students. Six recently finished the program and are working full time for Subaru, earning a base pay of almost $22 an hour, plus a bonus tied to attendance. One of the first participants made such an impression on his bosses at Subaru that he was quickly promoted to team leader.

The next class totaled 22 students, shared among Subaru and two of its suppliers as well as the nearby Caterpillar engine factory. One of those is Denise Flores, a 24-year-old whose internship is with Subaru. She previously worked in production at another local factory. Now she’s already doing a lot of preventive maintenance on her own, such as greasing robots, and proudly recounted how she replaced a stopper on a piece of equipment 20 feet in the air. It was a problem she’d spotted on her maintenance rounds.

Her ambitions now go beyond maintenance. She’s decided she wants to get into manufacturing engineering technology, which is all about making a factory flow better. “I can take this knowledge and be a better engineer,” she says.

Nic Herrera and Gabe Broderick are in their second year of the AIM program organized by Vincennes University and Lafayette, Ind., manufacturers. Tom Schott

Another student, Nic Herrera, is working at Heartland Automotive, a unit of a Japanese auto-parts maker, doing everything from fixing toilets to repairing hydraulics.

He has discovered he loves welding, something he first tried during the program’s lone semester on campus. At Heartland, he’s learning to fabricate machine parts. When a part broke and the replacement would take eight weeks to arrive from Japan, he and his team built a piece that would keep the machine running until it did.

“I came in not knowing anything about maintenance, but I like it,” he says, flashing a wide smile. “You get to work with your hands a lot.”