Yamato Tanooka was discovered by a soldier about 5.5 kilometres (3.4 miles) from where he went missing last Saturday, apparently in good health.
Reports said he had taken shelter in the hut and found a tap to drink from but was hungry and was immediately given food when discovered.
After the discovery, the boy’s contrite father appeared before the media and apologised for causing his son’s ordeal.
Yamato’s parents have been severely criticised on social media for forcing him out of their car on a mountain road as punishment for misbehaving.
“A Self-Defense Force official who was on a drill found a boy whose age appeared to be seven,” said Tomohito Tamura, spokesman for police on the northern island of Hokkaido.
“There was no conspicuous external injury, and the boy introduced himself as Yamato Tanooka,” he told AFP, adding that his parents were reunited with him and confirmed he was their son.
The boy “looked in good health” but was taken to hospital by helicopter for a check-up as a precaution, SDF spokesman Manabu Takehara said.
Yamato’s emotional father later bowed in apology when speaking to reporters outside the hospital where his child was being treatedK.
“My excessive act forced my son to have a painful time,” said Takayuki Tanooka.
“I deeply apologise to people at his school, people in the rescue operation, and everybody for causing them trouble,” he added, thanking those who searched for him.
“The first thing I said to my son was, ‘I’m very sorry to have caused you to face this suffering because of me,'” said the father, adding that his son nodded in return.
The parents originally told police their son got lost while they were out hiking to gather wild vegetables along with their daughter, but later admitted they had become angry with him for throwing stones at cars and people and had ordered him to get out of the car.
The local Hokkaido Shimbun newspaper said the boy had told police that on Saturday night he walked to the corrugated metal hut on the military base. Kyodo News reported he walked alone through the forest to get there.