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 59 times
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,969
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,747