Vanishing on 7th Street

Paul (John Leguizamo) is a projectionist in a Detroit theater who is reading about the 16th century disappearance of the Roanoke Colony when the lights suddenly go out in the theater. He finds that all the staff and patrons have mysteriously vanished, leaving only their clothes and non-biological parts behind. He comes across a security guard who is holding a flashlight. As Paul had a headlamp on for his reading they deduce that people holding sources of light are protected against whatever dwells in the darkness. The guard's flashlight goes out, and he vanishes. As Paul investigates, his headlamp goes out as well.
The following morning, news reporter Luke Ryder (Hayden Christensen) wakes to find that there is no power in the building. After descending from his apartment, he notices that the doorman is missing and the paper is still the previous day's edition. People have completely vanished from downtown streets, now littered with abandoned cars and pieces of clothing. He heads to the news station to find his girlfriend, and it is later revealed that he discovered a recording which shows his girlfriend vanishing on air when the lights go out. The only thing he is able to recover is her ring.
Three days pass, and Luke is alone trying to scavenge flashlight batteries or other sources of light. He briefly encounters a man who is taken by the darkness, before coming across a bar being powered by a backup generator. The bartender's young son, James Leary (Jacob Latimore), allows Luke to enter, followed soon after by another survivor, Rosemary (Thandie Newton).
Rosemary proves distant due to the trauma of her baby disappearing during the blackout, while James is convinced that his mother is at a church down the street and will soon return. They hear a man outside, and see Paul, who has mysteriously ended up under the lit sign of a bus stop across the road. Luke reluctantly leaves the safety of the bar to recover him and Paul reveals that he had been taken by the darkness, but the headlight that he had on had activated and he had found himself in the street three days later.
Due to Paul's massive concussion, Rosemary says that they need to find a hospital, and Luke suggests going to Chicago, where he saw a recording of a man just before the power went out at the news station three days prior. Paul tells them about the mystery of the Roanoke Colony where over a hundred settlers disappeared overnight, and they seem to be experiencing the same sort of occurrence. He tells them that the word "CROATOAN" was found carved into a fence post at the site of the empty colony when the next ship arrived. With the generator running down due to extended use, they realize it is only a matter of time before the power goes out on them.
Luke comes up with a plan to take one of the nearly dead trucks on the street and feed power to it with the generator. He and Rosemary leave to obtain one, nearly getting caught in the darkness when the vehicle breaks down and they lose the light. Rosemary hears a baby crying in the dark, ignoring Luke's warnings that it is the darkness trying to trick her, she is lured under a solitary street light, and the lamp goes out taking her with it.
At the bar, James goes to get Paul some water, and the drain on the power causes the lights to flash out. Wearing a glow-stick necklace, James is safe, but Paul vanishes from the pool table on which he is lying.
Luke manages to push a truck back to the bar, and he escapes with James using the generator to get the truck started. As they pass the church up the block, James gets out to find his mother. Luke leaves, but after a conflict of conscience, and seeing the word "CROATOAN" carved into a sign hanging off a bridge, he returns, using the high beams from the truck to fend off the darkness. When Luke gets out of the truck to get James, the car battery dies and Luke too disappears. As James cowers under the glow of candles, which begin to go out, he pleads with the darkness "I exist." and all but one candle goes out.
James wakes to daylight and sees the last candle had been burning all night. A little girl, Briana (Taylor Groothuis), appears and insists that James is sleeping on her bed, but urges him to stay with her. She shows him her flashlight, which is solar powered, allowing it to stay on all night without having to search for new batteries.
As they leave the church, they encounter a police horse eating spilled apples on the ground and decide to take it to Chicago. As the sun sets on the children leaving the city, the camera pans to the bar, casting the shadows of Luke, Paul and Rosemary watching the two leave as the darkness falls. As it gets dark, Briana's light comes on, ensuring their protection against the darkness as they begin their journey.

Question: What does James do with the generator?
Answer: James uses the generator to get the truck started