Like マイケルsan suggested, the best is to use Japan Rail Pass. This is the rail pass available ONLY for foreign tourists.
You can take ANY JR local trains, busses, rapid/express trains and shinkansens. The only shinkansen you cannot take is Nozomi, the fastest one.
If you're planning to travel across Japan or at least both Tokyo area and Osaka area, it's definitely very cheap.
Hope you can get it before coming to Japan
Take advantage of this great deal!!