I know that to execute a file, I use the .
command, then the file name with a space between them. But I'm trying to execute a .jar file using the .
and it does not work. I went into the properties and marked it as executable and made it run with Java.
Is there a way to execute a file with Java in the Bash Terminal?
I am trying to execute the Minecraft.jar file.
Best Answer
The
.
syntax can only be used to run (by "sourcing") shell scripts.You'll need to use the
java
command to run a.jar
file:If you don't have java installed, you can fix that by installing the
default-jre
ยน package. You can see if you already have java installed by running in a terminal:[1]: This will install the default openjdk Java runtime. You can use
openjdk-8-jre
, oropenjdk-7-jre
, oropenjdk-6-jre
instead, if you prefer - whichever is available on your version of Ubuntu.