2

I always thought, only executables in UNIX/Linux are ELF-files and shell scripts. But i found that it is possible to use just $ ./file.jar instead of $ java -jar file.jar.

How are JAR-files special? Are there other examples of this behavior? Can I create my own file type that can be executed only by its name/path?

  • 2
    Hello and welcome to Ask Ubuntu! I don't understand your question since in your title you say "how is it possible..." and then you mention "i found that it is possible...". I don't also understand why do you think that JAR files are special. If so, you think they are different to what? Thanks – Lucio May 16 '15 at 20:22
4

This is because ubuntu supports the binfmt_misc kernel module and the jar type is enabled. see /proc/sys/fs/binfmt_misc/jar

This is very old (since kernel 1.03). See more information here: https://stackoverflow.com/questions/1667830/running-a-jar-file-without-directly-calling-java

Other examples are python and wine, yes, if you learn how binfmt_misc works, you can create your own types too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.