The 23-year-old attacker was on loan with the Dons last season and - following his release from Manchester United - has opted to move to Pittodrie.
Aberdeen boss Derek McInnes told the club's official website: "I'm delighted to have James back.
"He is a young player who has had to deal with a lot in a short space of time, but he's got his whole career ahead of him.
"We feel that he showed glimpses towards the end of last season of how effective a player he can be and what a positive impact he can have on the team.
"We want to try and build on that now that he is an Aberdeen player and not a Manchester United player."