I found out how to fix this.
1: Go to .minecraft,then libraries,then com,then mojang,then realms.
If there's no 1.14.17,create a directory on there with that name.
Enter it and download this jar: https://libraries.minecraft.net/com/mojang/realms/1.14.17/realms-1.14.17.jar
Put it on the directory you made.
2:Try again!
Worked for me. Good luck!