What are your favorite period(s) in history of Japan? Where are you going?
As suggested by Emperor, if you want to visit the Imperial palaces in Tôkyô and Kyôto you'll need an application. Here is the site :
http://sankan.kunaicho.go.jp/order/index_EN.htmlIf you do the one in Tôkyô, try to visit on tuesday, wednesday or thursday, because the eastern gardens are closed the mondays and fridays.
If you want to visit castles, do some originals like Himeji, Matsumoto and Hikone.(i don't know if the Tenshu of Himeji is open to the public. It has been restored during several years). A lot of castles were reconstructed in concrete during the 50's to 70's. For more information on castles try these sites:
http://www.jcastle.info/http://castle.jpn.org/en/http://www.japanese-castle-explorer.com/Have fun visiting Japan.
PS: If you are going to use a lot of trains don't forget to buy your JR-Pass before going to Japan:
http://www.japanrailpass.net/