Hi!
Two years ago I did that journey... there's no train... You catch a bus in dubrovnic to the montenegro border and then you change to other bus that completes the trip to Bar!!!
Good trip... Bar it's like a ghost city... or it was 2 years ago!
Greetings from Portugal;
Salo