When I did that in may 2005, I took the train from Barcelona (main station), to Pamplona. It took about 6 hours. (20 euros)
Then I went by bus from Pamplona to Roncelsvalles. It took about 1 hour. (5 euros)
Then I went by a taxi (together with other pilgrims) to St.Jean. It took about 45 min. (5 euros each)
The problem here can be that the train and the bus do not correspond, so you might have to stay one night in Pamplona to take the bus the next day.
But Pamplona is a very nice city, so it will be just fine. (but avoid SanFermin)
2002 CF: 2004 from Paris: 2006 VF: 2007 CF: 2009 Aragones, Ingles, Finisterre: 2011 X 2 on CF: 2013 'Caracoles': 2014 CF and Ingles 'Caracoles":2015 Logrono-Burgos (Hospitalero San Anton): 2016 La Douay to Aosta/San Gimignano to Rome: