Maybe seeing their references may help you:
JUST - only, simply
"It was just a joke."
"She lives just down the road (= very near)."
"His daughter's just a baby/just a few weeks old."
JUST - used to make a statement or order stronger
"It's just too expensive."
"He just won't do as he's told."
JUST - used to reduce the force of a statement and to suggest that it is not very important
"Can I just borrow the scissors for a second?"
"I just wanted to ask you if you're free this afternoon."
ONLY - used to show that there is a single one or very few of something, or that there are no others
"I was the only person on the train."
"Is this really the only way to do it?"
"The only thing that matters is that the baby is healthy."
"It was the only thing I could do under the circumstances."
You see, 'just' you can use for different contexts, whereas 'only' is more specific. However, in some cases, as @dancingbear wrote, they are perfectly the same.