Updated - Adds video - The seven-year-old Japanese boy abandoned in a forest by his parents for being naughty meant to follow his parents' car but was crying so hard he went the wrong way, a newspaper said.

Feeling that the woods were "scary", Yamato Tanooka kept walking along the road even after the sun set, eventually arriving at a military base where he found an unlocked building and slipped in.

The massive search for Yamato Tanooka, after his parents left him by the side of a road in northern Japan as discipline for throwing stones at cars, kept Japan riveted for nearly a week until his discovery on a Japanese military base.

It prompted a flood of social media comment, much of it critical of the parents, but police said on Monday that they would not file charges.

The Mainichi Shimbun newspaper reported that he was sobbing so hard he took the wrong direction.

"I walked for about five hours, I think," Yamato was quoted as saying. After finding the building, "I was cold so I went inside to sleep."

Wearing a baseball cap and holding a paper baseball, Yamato waved at journalists and well wishers gathered in front of the hospital on Tuesday, occasionally flashing a gap-toothed smile.

Asked how he was feeling, the boy said: "I'm all right." He added that he was looking forward to getting back to school as his father took his hand and led him to a car.

Yamato's parents first said he disappeared while they foraged for edible plants, but later told police they had left him by the road to discipline him after he threw stones at people and cars.

They said when they drove back a few minutes later the boy had disappeared.

Yamato said he stayed in the unlocked building for the next six days with no food, although he drank water from an outdoor tap. Although he heard search helicopters flying overhead, he decided to stay where he was and await discovery, media said.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.