How to make an executable java file?

Hi, so I’m still working on my text-based java game in IntelliJ, and I’ve gotten it to a point where I can let people play it and it works normally. I thought that I would have to ask people to download IntelliJ and just copy-paste all the classes, but my teacher said that I could make an executable java file that I could just send people and they could just run it. Does anyone have any idea how to do this, and/or how that works?