The word “just” has several possible definitions:
Be careful – I just washed the floor, and it’s still wet.
(= I washed the floor a few minutes ago)
He just finished a big project.
(= he finished the project very recently)
I have just one brother. (= I have only one brother)
I thought you were hungry, but you ate just half of your sandwich.
(= you ate only half of your sandwich, and no more)
The word “only” can be replaced with “just” in most situations:
Only two students came to class on the day before Christmas.
= Just two students came to class on the day before Christmas.
My kids only use the internet for schoolwork, not for playing games.
= My kids just use the internet for schoolwork, not for playing games.
In the expression “If only…” you can use “just” if you change the structure a little bit:
If only I had studied harder. I would’ve passed the test.
= If I had just studied harder, I would’ve passed the test.