Is there any way for me to execute a .jar file with JRE through the command line. I'm having an issue with the file and I wanna see if I can get any information as to what the error is. When I try to execute it with ./ it says that that it can't execute binary file. But the icon gives me the option to run with Java Runtime Environment.
Asked
Active
Viewed 55 times
0
-
1Possible duplicate of How can I execute a .jar file from the terminal – David Foerster Apr 20 '16 at 21:03
-
@Danibix: Generic Unix administration questions are on topic here as long as they (may) occur in relation to a supported Ubuntu release. – David Foerster Apr 20 '16 at 21:04
2 Answers
0
You have to run it though the JRE, not directly. ie. java -jar myapp.jar
./
Is not actually a command to run a program/script/binary. It simply refers to the current directory. For example, if I have a script, myscript.sh
, in my home directory;
I can either run ./myscript.sh
or /home/myusername/myscript.sh
Both of those would run the script.
The reason why you couldn't just run myscript.sh
is because the termnal would try to interprit it as a known command, and throw this error: myscript.sh: command not found
because it isn't smart enough to know that you were trying to direct it to a file in your current dir
.

You'reAGitForNotUsingGit
- 14,809
0
As far as i know, the dote .
can only be used to run shell scripts.
So you have to use java command to run .jar
files
java -jar your_file_name.jar
That's it !

Bilal
- 3,699
-
THANK YOU! It also inadvertently fixed the error as the script re downloaded a cache that was causing the issue! – Kody Wilson Apr 20 '16 at 18:17