Quantcast
Channel: What has changed to prevent Java programs from running via the permission bit - Ask Ubuntu
Viewing all articles
Browse latest Browse all 2

What has changed to prevent Java programs from running via the permission bit

$
0
0

I have always set the execute bit on my Java Programs to call them like a regular program without using the -jar argument... just by running the application with the name in the path.

In the past, it only took: chmod +x myjavaprogram.jar, then running it with ./myjavaprogram.jar from the commandline.

It still works on my computers that have the Ubuntu version previous to 16.04. However, it doesn't work on any of my computers that are updated to 16.04.

I can't find any references to the problem, outside of suggestions to ensure the execute bit is set and some references to ensuring to have this installed: sudo apt install binfmt-support

I have never installed the package before, however, in an effort to fix the problem, I ran the installer which confirms it's already installed on Ubuntu by default and has the latest version.

The only other references I'm finding with problems with running java programs is specifications of properly having Java installed (openjdk or oracle). I have both installed with full updates. I also have used sudo update-alternatives --config java to change between the two. They both show the same error at the console.

This is what I get from the two methods:

Using the cli as a regular program:

$ ./HelloWorld.jar
invalid file (bad magic number): Exec format error

Using the -jar argument:

$ java -jar ./HelloWorld.jar 
Hello World

Many of my Java application that is in my /usr/local/bin folder are renamed without the java extension. They still work as a regular program on my computers that has the Ubuntu version previous to 16.04.

Doesn't anyone know how to add this functionality to version 16.04?

Update

Double clicking the applications from the file browser works.

However, I have tens of java apps that I run just like using the normal commandline tools such as, find, top, grep, netstat, and so on. Some of the commands call other java apps that are in the exec path.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images