Make sure your using a bit of an older java version and not the latest version. Like PowerfulTiger said, use J17. If you still have issues with that, you could try playing around with some different versions, I've had some issues getting it working before so the one I've been using has been J8 update 361, which to get I had to download it from the Oracle archive and then go to configure java and update it from there when I got it. I highly recommend using later versions like 17 as stated before since it's a lot easier to get working and can run better, but if you still have issues try to play around with what version your using a bit. For forge version, whenever you make a server to prevent issues make sure you use the same version of forge on the server as the mods your using. When you make a modpack on curseforge itll default to the recommend version, so if you use that make sure you download the recommended version from Forge as well for the server. Make sure you also don't allocate too much memory when starting a server as more memory can also slow down preformance. For my ~160 mod server with about 4 people on it at one time I use 8GB. If you have any more questions or need any help don't be afraid to ask.