San Jose Airport is connected to the local light rail by a free shuttle bus, or you can get one of the scheduled bus services that service the airport as well (http://www.vta.org/). Taxis also serve the airport and can transport you to Sunnyvale for around $25 one way, for example.
San Jose Airport connects to Caltrain by VTA bus line 10, a free shuttle between the airport and the Santa Clara Caltrain station and transit center. Various other local VTA bus lines also leave from this transit center.
From the San Francisco Airport SFO use the BART connection to Caltrain and take Caltrain south. Note that the two train systems require separate tickets.