This question already has an answer here:
I often run Java .jar files, but in order to do so, I must invoke it with the command
java -jar myJar.jar. Simply making the .jar executable will not allow it to be run, since it is not fully compiled. The .jar must also be in my current directory to do so.
What I am asking is is there any way to make it so that I can run a .jar by simply invoking it with
myJar, provided it is in somewhere defined by $PATH? Is there any way to specify that it must be run with the Java interpreter?
I am using the Oracle JDK.