If you arrive in Barcelona at 17:00, that is the time the plane lands. Now get off the plane, get luggage, find the Metro / bus / train to the main train station - add another hour or so. If security is high, like now, it may take longer to get through those checks. Add another hour. Travel time to the RENFE train station is about 1 hour from the airport. Give yourself at least 30 minutes to find things in a new place.
You will not get to the RENFE trains until 20:00. There are no trains to Pamplona that late.
Spend the night in Barcelona, take the early train to Pamplona. Plan 1 hour from your location to the RENFE station, then 4 hours on the train, then 30 minutes to get to the bus station, then 1.5 hours on the bus before you get to St. Jean. That is a full day of travel, add a bit of time to eat lunch, get snacks for the train trip. Taking the earliest train to Pamplona, you will arrive in St Jean at about 13:00 to 14:00.