Reputation: 394
When I execute a .jar with this command line (it's a command found in a script):
./MyJar.jar AUTO
I have these errors :
./MyJar.jar: 1: ./MyJar.jar: PK: not found
./MyJar.jar: 2: ./MyJar.jar:: not found
./MyJar.jar: 3: ./MyJar.jar: ��H: not found
./MyJar.jar: 4: ./MyJar.jar:: not found
./MyJar.jar: 5: ./MyJar.jar: Ant-Version:: not found
./MyJar.jar: 6: ./MyJar.jar: Syntax error: "(" unexpected
But when I execute with this command line, it works:
java -jar MyJar.jar
Upvotes: 0
Views: 156
Reputation: 394
I have found the answer to my second question. To be able to execute my jar this way:
./MyJar.jar AUTO
I need to install the binfmt-support package :
sudo apt-get install binfmt-support
As mentionned on this topic : https://askubuntu.com/a/291514
Upvotes: 1
Reputation: 559
normally if any file trying execute directly by Linux terminal file header information should be identified by OS. for example:
#!/bin/bash
echo "Hello World"
or
#!/usr/bin/python
print "Hello World"
you can see OS will understand 1st script should be run by /bin/bash interpreter and 2nd is python interpreter.
it seems OS don't under understand how to execute your ./MyJar.jar file. but jar can directly understand your file content
Upvotes: 1