U simply don't understand how international relations & diplomacy works mate.
Japanese economy has got saturated, yes there economy is nearly thrice that of Indian economy, but they cannot grow as much as India is growing currently & will be in future, as prediction goes India will soon become Asia's No. 2 & world's no. 3 economy leaving Japan behind in a decade or so, so what Japan is investing is in it's future, It has the US cover (military, nuclear, economical) but US is finding itself in troubles as the rise of China is becoming more & more inevitable, Japan is getting terrified by this inevitable, so it sees India as a power that can balance the rise of China in Asia & the world (can u name any other country??), Yes, India can't be compared to China, but World's largest democracy having 3rd largest army, 4th largest air force, 5th largest Navy, tenth largest GDP in nominal terms & third largest in PPP terms, can't be ignored also. Otherwise why do u think that a country that is totally opposed to nukes will be negotiating for nuclear trade, with a country like India that has not even signed the NPT.
If China is balanced out by US in the Pacific & SCS while India does the same in IOR than this gives the much needed breather to Japan assuring that trade through these sea routes get going uninterrupted & threat of an attack by China is minimized, thus Japan can tackle it's economic issues with peace.
Not just Japan many other East Asian country are forging stronger relationship with India to balance the rise of China, SK, Vietnam, Malaysia, Indonesia, Myanmar to just name a few.