Score:-3

Does Java Binary Kernel Support work already?

in flag

Is this already available in Ubuntu? https://docs.kernel.org/admin-guide/java.html

Has someone tried it or is it still just a theory?

Hiran Chaudhuri avatar
in flag
Could someone explain why this got downvoted? After all the kernel documents did not explain what a user needs to do on Ubuntu. After all jar files do not execute just as-is. Not much is missing though.
muru avatar
us flag
Because you could have searched for keywords from the docs you linked to (`binfmt_misc` and java).
Hiran Chaudhuri avatar
in flag
This is anything but clear. Check https://duckduckgo.com/?q=binfmt_misc+java+ubuntu&t=ffab&atb=v230-1&ia=web It may be that your Google search shows it because of your googling history.
muru avatar
us flag
Didn't say anything about Google. There's search functionality in this site too, with features such as sorting by score, activity, etc.
Score:3
in flag

BINFMT_MISC has been part of linux for a very long time.

Unix has a long history of allowing any file to be treated as an executable, just by putting #!/path/to/interpreter as the first line in the file and using chmod +x to mark it as executable.

The BINFMT_MISC method is just a slight expansion of that philosophy, where instead of the interpreter name being embedded as text in the first line of the file, you tell the kernel how to recognize a particular binary type and tell it what interpreter to use on that file type.

You can check to see if it is enabled on your system by checking to see if /proc/sys/fs/binfmt_misc exists:

ls -l /proc/sys/fs/binfmt_misc

If that exists, there should be a file in it for each supported misc executable type. On my Ubuntu system, there is a file in there called jar that corresponds to java.

Hiran Chaudhuri avatar
in flag
So is it active on Ubuntu?
user10489 avatar
in flag
Updated answer so you can check for yourself.
Hiran Chaudhuri avatar
in flag
I checked already. See my answer.
Score:0
in flag

On Ubuntu 20.04 I just took a jar file, marked it as executable and was able to run it by just putting the jar filename into the shell. This BINFMT stuff seems to be installed and active. :-)

$ chmod +x some.jar
$ ./some.jar

This is great! :-)

Hiran Chaudhuri avatar
in flag
Hmmm. Just having upgraded to Ubuntu 22.04.1 I notice this feature no longer works.
user10489 avatar
in flag
Possibly you don't have a java interpreter installed....
Hiran Chaudhuri avatar
in flag
I only upgraded - it is not an installation from scratch. Before I had Java 16 as system default, now it is Java 17. But it is not registered for executing jar files.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.