Unable to run java programs from Thunar with Java 8. Can't even set JAR files to be executable.

Java 8 somehow don't recognized by Thunar anymore.

I didn't used Java programs recently, but I can run them from Thunar for sime time ago.
But it doesn't work anymore.

First I just simply clicked on the JAR file to run it. Nothing happened.
I thought maybe I forget to set it executable, but there is no option to set it to executabe. Some times ago it was possible to set JAR files to be executable within Thunar. Not anymore.
It turned out the JAR file is already executable, so the problem is not that.
So I right clicked on the file and I saw only Engrampa shown in the "Open with.." field.
So I choose the "Open With Other Application", but Java 8 isn't there!

After this, I installed the latest OpenJDK (version 11) and that java version come up in Thunar in the "Open With..." filed, and the option to set the JAR file executabe is there too.
I tried it with version 10 JDK and that works too. Only the Java version 8 that is not working from Thunar.
By the way, from terminal I can run those JAR files, so technically Java 8 is working. Only Thunar can't recognize it.

My problem is that the JAVA program doesn't work with never versions of JAVA. It only works with Java 8.
The programs that try to run are: Technic Launcer, MultiMC to play modded Minecraft.

I like to know how I can add Java 8 to Thunar, so I can run Java programs from Thunar again with mouse-click, so I don't need to use command line (or create bash scripts)?

this is an old thread but i hope this is still relevant


Solution for Xfce / Thunar file manager
Right-click a Java .jar file in your file manager and from the context menu select "Open With Other Application". At the bottom of the "Open With" dialog click on "Use a custom command". Input this command:
/usr/bin/java -jar
Then tick the box "Use as default for this kind of file" at the bottom and click on the button "Open" to close the dialog. Problem solved. When you now double-click Java .jar files in your file manager they will run as expected.

replace the command with whatever you used for running in terminal

Thanks for the quick reply.
I forgot to mention it in my post, but I tried that one too, but that doesn't work.
If I do that, nothing happens, the program won't even start, it's really seems like Thunar don't want to recognize older Java version, just the newer ones.

Oh, and the programs that I try to run are the Technic Launcer and the FTB Launcher, not MultiMC. That is not a Java program. Sorry, my bad.

What happens if you run it in a terminal?

java will point to the default version, not necessarily the OpenJDK 8 version.

What @badbodh said but use the command /usr/lib/jvm/java-8-openjdk/bin/java -jar instead. Of course this will default every java application to java 8 which may or may not be what you want.

Like I said in my first post. If I use the terminal it works perfectly. No need to hassle around with anything. It just enough to simply run as you usually run Java programs from terminal: "java -jar /path/to/the/program.java" or just "java -jar program.jar" if I'm already in the folder where the JAR file is located.
Default version? I only have OpenJDK 8 installed.
The output of "java -version" command is:

openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b03)
OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)

This thing (IMO) is definitely something on Thunar's side.
If I install newer Java versions, everything works from Thunar: First it's recognize the file that it is an executable simply double-click on the JAR and it runs, or even when I right click then "Open With Other Application..." and "Use a custom command", then I give usual "java -jar" command or even with the full path. But of course the programs don't works because they runs only with version 8.
With the version 8, Thunar doesn't even recognize the JAR file that that is an executable Java program. Like when you have no Java installed at all.

I also tried to fix this issue with the "MIME Type Editor" but I can't figured it out why only the newer Java versions works from Thunar.

it's possible that java 11 comes with a .desktop launcher in /usr/share/applications while java 8 has no such file. That could explain why thunar (or any file manager) would treat them differently.
This is a java 11 runtime launcher from ubuntu named "openjdk-11-java.desktop"

[Desktop Entry]
Name=OpenJDK Java 11 Runtime
Comment=OpenJDK Java 11 Runtime
Exec=cautious-launcher %f /usr/bin/java -jar

You can create a launcher ~/.local/share/applications/openjdk-8-java.desktop using any text editor (it's just a text file with .desktop extension) with appropriate changes to Name and Exec entries. Thunar will use the Mimetype entry to determine file associations.

[Desktop Entry]
Name=OpenJDK Java 8 Runtime
Comment=OpenJDK Java 8 Runtime
Exec=cautious-launcher %f /usr/lib/jvm/java-8-openjdk/bin/java -jar

You may also try Exec=/usr/lib/jvm/java-8-openjdk/bin/java -jar %f if above doesn't work

1 Like

No it's not... I checked that and no desktop launchers are created. None of the Java installations -regardless of which version- creates desktop launchers there. So this isn't solve the problem why now Thunar don't recognize Java 8 and JAR files, like it does some time ago.

Thanks for trying to help, but why you even post anything if you aren't sure about it?
Did you checked it before creating your post? Can I ask; why you even posted this, if you doesn't even know how those things really works recently?
You aren't even using Manjaro, but Ubuntu...;

That isn't helpful, won't solve any problem, just generates even more confusion.
Maybe that is how this thing works in Ubuntu, but this isn't Ubuntu.
I thought I posting on the Manjaro forums...

Maybe you missed my question:

...without use command line or creating scripts...and using Thunar...and using Manjaro, not Ubuntu...

Like I said, in some times ago it was possible to simply double-click on a JAR file, to run it in Thunar, or -if it is needed- set it to executable. And like I said, I can run JAR files from terminal or can create scripts to do it form me, so I don't need to type the commands every time.
But that desn't solve the problem; that Thunar can't do the same things by default, that it can do some times ago.
I need help to fix this. Run Java programs in the Thunar file manager with doubleclick on them.

I don't know if this is a language issue, but you were particularly ignorant to the last poster who attempted to offer you advice. Whether you think the advice is applicable or not, is no excuse for your rudeness to someone who was only attempting to help you.

Good luck getting your issue resolved.

1 Like

Apologies for generating confusion.
Regardless of distro some basics remain the same. Do note that I am not developer so my opinions are not even remotely accurate in technicality.

File managers don't know how to open a file. First they look into ~/.config/mimeapps.list then /usr/share/applications/mimeinfo.cache to know which application to launch when you double click on a file.

This is how entries in above files look like


Notice that they point to a *.desktop file which is written to launch a particular program. As you mentioned none of the java installations provide such a desktop file, so you create one. Now your launcher should show up in "open with" list.

That kinda sums up the expected behaviour.

If that don't work, something is wrong somewhere. Let's find out how to pinpoint the underlying problem and adjust expectations if need be.

Have you tried other file managers ? pcmanfm, spacefm, nautilus, nemo, caja do they open java-8 as expected ? If yes, then Thunar is indeed broken. Manjaro doesn't make Thunar. They simply borrow from Archlinux which in turn borrows from upstream XFCE devs. What you can do is wait for a bugfix update, or file a bug report yourself. If it's a design choice by upstream devs, you are out of luck.

If Thunar is All-OK, then maybe java-8 is broken. Java is weird, maybe some component is broke. Maybe some security policy is broke. Maybe Oracle™ broke it. And they don't care. It will remain broke forever. Now you are really out of luck.

What's common in both cases is that Manjaro devs or forum members can do very little to those errant source codes upstream. They don't own it, and probably don't understand it. Even if they do, their commits may not be accepted by upstream devs because Jesus said so in mandarin.

All things said and done, you could try this

Due warnings on using AUR stuff from benevolent strangers on the internet

Regards and cheerios

1 Like

I'm hoping you have already gone through

since ubuntu has its own way of managing java versions i cannot comment on this without running a manjaro vm.

Hm. There may be some confustion between JRE and JDK:

$ ls -l /usr/share/applications/*jdk*
-rw-r--r-- 1 root root 401 May 20 22:57 java-java-openjdk.desktop
-rw-r--r-- 1 root root 358 May 20 22:57 jconsole-java-openjdk.desktop
-rw-r--r-- 1 root root 220 May 20 22:57 jshell-java-openjdk.desktop
-rw-r--r-- 1 root root 431 May 20 22:57 policytool-java-openjdk.desktop
$ pacman -Qo /usr/share/applications/java-java-openjdk.desktop
/usr/share/applications/java-java-openjdk.desktop is owned by jdk-openjdk 11.0.3.u7-0

The jre-openjdk package does not include any .desktop files.

This might be a packaging bug:

$ cat /usr/share/applications/java-java-openjdk.desktop
[Desktop Entry]
Name=OpenJDK Java 11 Runtime
Name[fi]=OpenJDK Java 11 - ajonaikainen ympäristö
Comment=OpenJDK Java 11 Runtime
Comment[fi]=OpenJDK Java 11 - ajonaikainen ympäristö
Exec=/usr/lib/jvm/java-11-openjdk/bin/java -jar

This indicates that the desktop launcher for java -jar is in the JDK package but not the JRE package. This seems the wrong way round...

That's because "jre" package does not provide the java executable in /bin. Gotta have "jdk" installed either way. It's a feature not bug :grin:

Trouble is jdk8 does not provide a launcher

while jdk11 provides java-java-openjdk.desktop among other things

@Gofri you need to either create your own launcher or stick to the terminal. This is not guaranteed to work though. There's probably some good reason why arch devs decided to drop the launchers to begin with.

1 Like

Thanks, now with all the other info you posted since I last time checked this post, things are getting more clear.
But still can't run Java programs from Thunar, like back in those times, when it was worked.

It looks like, that I have no other choice, but using terminal or create a script (these are the things that I wanted to avoid, but it seems I can't) to run them.

You mentioned that you hope that I already gone through that "Swithching between JVM" wiki.
I did it, because I find an alternative version of Java, that works better than the default OpenJDK/JRE. It is the OpenJ9.
After installing it I set it as the default Java with the "archlinux-java" command, and (of course I had to make a damn script) and using terminal to run those Java programs.
So, as you guys said; if you want it to work, use scripts and terminal.

Too bad that I like to do things with the easyest way; click on it... :sweat_smile:
So I need to use the 'hard' way (or am I started to be a bit of a lazy old folk? :laughing:), using the keyboard a bit more...

Still, it would be good to know, why Thunar don't like OpenJDK 8 as before.

Forum kindly sponsored by Bytemark