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.
java -jar
part. I have done something similar with file manager some time ago to double click on jar file and run them in open terminal. But i haven't seen simply calling a jar file by name. Good question. – Sergiy Kolodyazhnyy Jul 25 '16 at 01:09