Taking Rental cars accross national borders on a one way basis tends to be very expensive (as the rental company probalby won't be able to rent the car you picked up in Barcelona again until it's been returned to Spain) .. so I don't think it would be practical to drive the whole way (in one car at least)
Train would be probably the best ... very good services along the mediterranean coast easily do-able in 16 days with a few stops (though you could spend a lot longer at it too)
Using the trains for the cross border sections would make the most sense as pointed out above, you could then hire a car for the French element of the trip.