Japan is a relatively safe country for women travellers, though perhaps not quite as safe as some might think. Crimes against women are generally believed to be widely under-reported, especially by Japanese women. Foreign women are occasionally subjected to some forms of verbal harassment or prying questions. Physical attacks are very rare, but have occurred.
The best advice is to avoid being lulled into a false sense of security by Japan's image as one of the world's safest countries and to take the normal precautions you would in your home country. If a neighbourhood or establishment looks unsafe, then treat it that way. As long as you use your common sense, you will most likely find that Japan is a pleasant and rewarding place to travel as a woman.
Several train companies have introduced women-only cars to protect female passengers from chikan (men who grope women and girls on packed trains). These cars are usually available during rush-hour periods on weekdays on busy urban lines. There are signs (usually in pink) on the platform indicating where you can board these cars, and the cars themselves are usually labelled in both Japanese and English (again, often in pink).
While it's a little old, Caroline Pover's Being A Broad in Japan (2001) is still a good resource for any woman setting up in Japan.