Java and Optifine download for Minecraft on Endless

Ok so, I already checked out the other optifine topic here, but it didnt really help my problem. I have optifine installed for 1.19.2 minecraft, I have the minecraft flatpak and it works when it comes to resource packs. Im having trouble downloading Java though, which is what I need to run the command to run the optifine installer instead of just opening the jar file, so I was wondering how to do both of these on Endless.

Use TL: Legacy available in the App Center