sorting out file associations [SOLVED]

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
ginahoy
Level 3
Level 3
Posts: 188
Joined: Sun May 28, 2017 3:15 pm

sorting out file associations [SOLVED]

Post by ginahoy » Tue Nov 06, 2018 12:35 am

I recently installed Internet Connectivity Monitor (ICM), which is a java script (internetconnectivity.jar). When I tried to launch the program, my OS simply opened the .jar file with Archive Manager. Using the context menu (right-click on .jar file), I associated that file (and presumably all .jar files) with Java Runtime Environment (JRE). It works fine now. I installed a shortcut on my desktop so I can double click on the icon and it opens the ICM user interface.

Unfortunately this caused an unexpected side effect. When I double-click on a zip file, it tries to run the file as a java script. Again, using the context menu, I associated a .zip file with Archive Manager. However, that also changed the association with the ICM .jar file. So how do I associate .zip files with Archive Manager while simultaneously associating .jar files with JRE?
Last edited by ginahoy on Thu Nov 08, 2018 3:09 am, edited 1 time in total.
Linux Mint 18.2 Xfce x64 | ASRock Z270 Extreme4 | Core i7 7700K | Cryorig H7 cooler| 32GB DDR4 2400| modded legacy Evercase LE4252 | EVGA 450W B3 | Samsung 850 EVO SSD

User avatar
smurphos
Level 12
Level 12
Posts: 4108
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: sorting out file associations

Post by smurphos » Tue Nov 06, 2018 2:20 am

Can you post the output of cat ~/.config/mimeapps.list
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

ginahoy
Level 3
Level 3
Posts: 188
Joined: Sun May 28, 2017 3:15 pm

Re: sorting out file associations

Post by ginahoy » Tue Nov 06, 2018 3:53 am

smurphos wrote:
Tue Nov 06, 2018 2:20 am
Can you post the output of cat ~/.config/mimeapps.list

Code: Select all

bash: /home/david/.config/mimeapps.list: Permission denied
Linux Mint 18.2 Xfce x64 | ASRock Z270 Extreme4 | Core i7 7700K | Cryorig H7 cooler| 32GB DDR4 2400| modded legacy Evercase LE4252 | EVGA 450W B3 | Samsung 850 EVO SSD

User avatar
smurphos
Level 12
Level 12
Posts: 4108
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: sorting out file associations

Post by smurphos » Tue Nov 06, 2018 4:00 am

Sorry typo my end - the full command is

cat ~/.config/mimeapps.list
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

ginahoy
Level 3
Level 3
Posts: 188
Joined: Sun May 28, 2017 3:15 pm

Re: sorting out file associations

Post by ginahoy » Tue Nov 06, 2018 4:15 am

smurphos wrote:
Tue Nov 06, 2018 4:00 am
Sorry typo my end - the full command is
cat ~/.config/mimeapps.list
Thanks. I should have realized the cat was missing 8)

BTW, I should clarify that to make the .jar file run, I have to open "Properties" for the ICM desktop shortcut context menu, then select JRE in the "Open with" field. Otherwise, if I simply select JRE from the context menu, it doesn't stick. However, selecting JRE from "Properties / Open with.." for the .jar shortcut also changes the zip association to JRE.

Here's the output:

Code: Select all

[Added Associations]
text/plain=xed.desktop;
application/mbox=xed.desktop;libreoffice-writer.desktop;
application/octet-stream=xed.desktop;FoxitReader.desktop;libreoffice-writer.desktop;org.gnome.FileRoller.desktop;xviewer.desktop;gdebi.desktop;
application/pdf=FoxitReader.desktop;gimp.desktop;xreader.desktop;
image/gif=xviewer.desktop;
image/jpeg=xviewer.desktop;gimp.desktop;pix.desktop;XnView.desktop;display-im6.desktop;
application/vnd.ms-excel=libreoffice-calc.desktop;
application/msword=libreoffice-writer.desktop;
x-scheme-handler/http=exo-web-browser.desktop
x-scheme-handler/https=exo-web-browser.desktop
x-scheme-handler/ftp=firefox.desktop;userapp-Firefox-526V7Y.desktop;plexmediamanager.desktop;
x-scheme-handler/chrome=firefox.desktop;userapp-Firefox-526V7Y.desktop;plexmediamanager.desktop;
text/html=firefox.desktop;xed.desktop;userapp-Firefox-526V7Y.desktop;plexmediamanager.desktop;
application/x-extension-htm=firefox.desktop;userapp-Firefox-526V7Y.desktop;plexmediamanager.desktop;
application/x-extension-html=firefox.desktop;userapp-Firefox-526V7Y.desktop;plexmediamanager.desktop;
application/x-extension-shtml=firefox.desktop;userapp-Firefox-526V7Y.desktop;plexmediamanager.desktop;
application/xhtml+xml=firefox.desktop;userapp-Firefox-526V7Y.desktop;plexmediamanager.desktop;
application/x-extension-xhtml=firefox.desktop;userapp-Firefox-526V7Y.desktop;plexmediamanager.desktop;
application/x-extension-xht=firefox.desktop;userapp-Firefox-526V7Y.desktop;plexmediamanager.desktop;
video/mp4=xplayer.desktop;vlc.desktop;
application/zip=JB-java-jdk8.desktop;org.gnome.FileRoller.desktop;file-roller.desktop;
application/vnd.corel-draw=libreoffice-draw.desktop;
image/x-xcf=gimp.desktop;
text/x-csrc=xed.desktop;
application/javascript=libreoffice-writer.desktop;xed.desktop;
application/json=xed.desktop;
application/vnd.openxmlformats-officedocument.wordprocessingml.document=libreoffice-writer.desktop;
text/csv=libreoffice-calc.desktop;xed.desktop;
application/postscript=xreader.desktop;
image/png=xviewer.desktop;XnView.desktop;
image/vnd.microsoft.icon=xviewer.desktop;
application/x-sqlite3=libreoffice-writer.desktop;xed.desktop;
text/x-log=xed.desktop;
application/x-shellscript=xed.desktop;
application/gzip=file-roller.desktop;
application/x-bzip=file-roller.desktop;
inode/directory=exo-file-manager.desktop
x-scheme-handler/trash=exo-file-manager.desktop
x-scheme-handler/mailto=exo-mail-reader.desktop
text/css=xed.desktop;libreoffice-writer.desktop;
application/xml=xed.desktop;
application/x-xpinstall=xed.desktop;libreoffice-writer.desktop;org.gnome.FileRoller.desktop;file-roller.desktop;
application/rdf+xml=libreoffice-writer.desktop;
image/bmp=xviewer.desktop;
application/x-rar=file-roller.desktop;
video/mpeg=xplayer.desktop;
video/x-flv=xplayer.desktop;
text/x-matlab=xed.desktop;
application/x-perl=xed.desktop;
image/x-xpixmap=xed.desktop;gimp.desktop;xviewer.desktop;
application/x-lz4=org.gnome.FileRoller.desktop;
video/x-msvideo=xplayer.desktop;
video/webm=xplayer.desktop;
text/x-scheme=xed.desktop;
application/x-php=xed.desktop;
application/x-subrip=xed.desktop;
video/quicktime=xplayer.desktop;
audio/aac=plexmediamanager.desktop;
audio/mpeg=xplayer.desktop;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet=libreoffice-calc.desktop;
application/x-xz-compressed-tar=org.gnome.FileRoller.desktop;
text/x-readme=xed.desktop;
application/vnd.debian.binary-package=gdebi.desktop;
application/x-java-archive=file-roller.desktop;JB-java-jdk8.desktop;
application/x-java=libreoffice-writer.desktop;xed.desktop;
application/x-compressed-tar=file-roller.desktop;
application/x-desktop=JB-java-jdk8.desktop;

[Default Applications]
x-scheme-handler/http=firefox.desktop
x-scheme-handler/https=firefox.desktop
x-scheme-handler/ftp=firefox.desktop
x-scheme-handler/chrome=firefox.desktop
text/html=firefox.desktop
application/x-extension-htm=firefox.desktop
application/x-extension-html=firefox.desktop
application/x-extension-shtml=firefox.desktop
application/xhtml+xml=firefox.desktop
application/x-extension-xhtml=firefox.desktop
application/x-extension-xht=firefox.desktop
application/pdf=FoxitReader.desktop
application/ppdf=FoxitReader.desktop
application/octet-stream=FoxitReader.desktop
application/zip=JB-java-jdk8.desktop
application/x-java-archive=JB-java-jdk8.desktop
Linux Mint 18.2 Xfce x64 | ASRock Z270 Extreme4 | Core i7 7700K | Cryorig H7 cooler| 32GB DDR4 2400| modded legacy Evercase LE4252 | EVGA 450W B3 | Samsung 850 EVO SSD

gm10
Level 18
Level 18
Posts: 8738
Joined: Thu Jun 21, 2018 5:11 pm

Re: sorting out file associations

Post by gm10 » Tue Nov 06, 2018 4:29 am

ginahoy wrote:
Tue Nov 06, 2018 4:15 am
Here's the output:

Code: Select all

[Default Applications]
application/zip=JB-java-jdk8.desktop
application/x-java-archive=JB-java-jdk8.desktop
Ok, so .jar files should currently open correctly, right? Now just change the application/zip= line in that bottom section near the end of the file to read like this and you should be good:

Code: Select all

application/zip=file-roller.desktop;
Might be you'll have to restart nemo for the change to take effect.

ginahoy
Level 3
Level 3
Posts: 188
Joined: Sun May 28, 2017 3:15 pm

Re: sorting out file associations

Post by ginahoy » Tue Nov 06, 2018 4:36 am

gm10 wrote:
Tue Nov 06, 2018 4:29 am
Ok, so .jar files should currently open correctly, right? Now just add this at the end of the file and you should be good:

Code: Select all

application/zip=file-roller.desktop;
Might be you'll have to restart nemo for the change to take effect.
Thanks. Before I make the change, I should point out that I'm running xfce desktop with Thunar file manager, not Nemo. My objective is for "Archive Manager" to be the default application for .zip files. Is file-roller the right association for my setup?
Linux Mint 18.2 Xfce x64 | ASRock Z270 Extreme4 | Core i7 7700K | Cryorig H7 cooler| 32GB DDR4 2400| modded legacy Evercase LE4252 | EVGA 450W B3 | Samsung 850 EVO SSD

gm10
Level 18
Level 18
Posts: 8738
Joined: Thu Jun 21, 2018 5:11 pm

Re: sorting out file associations

Post by gm10 » Tue Nov 06, 2018 4:53 am

ginahoy wrote:
Tue Nov 06, 2018 4:36 am
Thanks. Before I make the change, I should point out that I'm running xfce desktop with Thunar file manager, not Nemo. My objective is for "Archive Manager" to be the default application for .zip files. Is file-roller the right association for my setup?
Yes, at least LM19 Xfce comes with file-roller as the default. The window title is Archive Manager indeed. Should be the same for LM18, which I assume you're on (you didn't say but LM19 defaults to openjdk-11, not -8 that you're using).

Please note that I had instantly edited my post but you still seem to have seen the original version. You don't need to add the line, you need to edit the existing one (had missed that one in my initial scan of your file).

ginahoy
Level 3
Level 3
Posts: 188
Joined: Sun May 28, 2017 3:15 pm

Re: sorting out file associations

Post by ginahoy » Tue Nov 06, 2018 5:09 am

Ok. I just saw your edited post and made the change. However, that broke ICM desktop shortcut. Is this an XFCE bug? Desktop shortcuts surely are not zip files?!
Linux Mint 18.2 Xfce x64 | ASRock Z270 Extreme4 | Core i7 7700K | Cryorig H7 cooler| 32GB DDR4 2400| modded legacy Evercase LE4252 | EVGA 450W B3 | Samsung 850 EVO SSD

ginahoy
Level 3
Level 3
Posts: 188
Joined: Sun May 28, 2017 3:15 pm

Re: sorting out file associations

Post by ginahoy » Tue Nov 06, 2018 5:20 am

Interestingly, if I repair the .zip association and then open the ICM .jar file directly, it works (meaning, .jar is still associated with JRE, not Archive Manager). However, the shortcut to the .jar file is still associated with Archive Manager. Like I said, it's as if xfce is treating the desktop shortcut as a zip file. In Windows, shortcuts in of themselves don't have any implicit associations. They're simply pointers to another file. So clicking a shortcut always invokes the application associated with the target file extension.

I had previously tried to create a launcher on my desktop, in lieu of a shortcut. That's the only way I can see to adopt ICM's icon image. However, I wasn't able to get that to work. I get "Failed to execute, permission denied" error.

The obvious workaround is to put the ICM .jar file itself on the desktop. But that begs the question, why should that even be necessary?
Linux Mint 18.2 Xfce x64 | ASRock Z270 Extreme4 | Core i7 7700K | Cryorig H7 cooler| 32GB DDR4 2400| modded legacy Evercase LE4252 | EVGA 450W B3 | Samsung 850 EVO SSD

gm10
Level 18
Level 18
Posts: 8738
Joined: Thu Jun 21, 2018 5:11 pm

Re: sorting out file associations

Post by gm10 » Tue Nov 06, 2018 5:32 am

ginahoy wrote:
Tue Nov 06, 2018 5:20 am
Interestingly, if I repair the .zip association and then open the ICM .jar file directly, it works (meaning, .jar is still associated with JRE, not Archive Manager). However, the shortcut to the .jar file is still associated with Archive Manager. Like I said, it's as if xfce is treating the desktop shortcut as a zip file. In Windows, shortcuts in of themselves don't have any implicit associations. They're simply pointers to another file. So clicking a shortcut always invokes the application associated with the target file extension.
What type of shortcut is it? If it's a symbolic link, it should work for sure, but the problem with needing to restart the file manager that I mentioned might come into play here. In this case you'd need to restart whatever process provides the desktop, but the easy way for that is to simply log out and back in (also I don't recall off the top of my head what that process is in Xfce :P). I'm quite confident it will work correctly then.

But if your shortcut is a launcher (a .desktop file) you may need to edit its command line.

ginahoy
Level 3
Level 3
Posts: 188
Joined: Sun May 28, 2017 3:15 pm

Re: sorting out file associations

Post by ginahoy » Tue Nov 06, 2018 6:57 am

Yes, it's a symbolic link. When I right click on the desktop icon and click Properties, the "Kind" field says "link to [path]/internetconnectivitymonitor.jar" (see screenshot, below). As you can see, it's currently is associated with Archive Manager, but if I change that to Java Runtime Environment (JRE), it changes the zip association in the memeapps.list file as well. Rebooting doesn't resolve.
.
Screenshot_2018-11-06_03-36-44.png
.
As I said, I also tried setting up a launcher, but I get an permissions error. If I can get that to work, that would make the shortcut bug moot for the time being. What do you mean by editing the command line? I simply entered the path to the ICM .jar file as thus:

Code: Select all

'/home/david/opt/internet connectivity monitor/InternetConnectivityMonitor.jar'
Linux Mint 18.2 Xfce x64 | ASRock Z270 Extreme4 | Core i7 7700K | Cryorig H7 cooler| 32GB DDR4 2400| modded legacy Evercase LE4252 | EVGA 450W B3 | Samsung 850 EVO SSD

gm10
Level 18
Level 18
Posts: 8738
Joined: Thu Jun 21, 2018 5:11 pm

Re: sorting out file associations

Post by gm10 » Tue Nov 06, 2018 7:06 am

ginahoy wrote:
Tue Nov 06, 2018 6:57 am
Yes, it's a symbolic link. When I right click on the desktop icon and click Properties, the "Kind" field says "link to [path]/internetconnectivitymonitor.jar" (see screenshot, below). As you can see, it's currently is associated with Archive Manager, but if I change that to Java Runtime Environment (JRE), it changes the zip association in the memeapps.list file as well. Rebooting doesn't resolve.
Weird. Have you compared what it actually changes in the ~/.config/mimeapps.list file? That might provide some insights into what's wrong.

I just tried this in a LM19 Xfce virtual machine and all the file associations worked correctly by default, couldn't reproduce any of these issues so I cannot really say what's going on.
ginahoy wrote:
Tue Nov 06, 2018 6:57 am
As I said, I also tried setting up a launcher, but I get an permissions error. If I can get that to work, that would make the shortcut bug moot for the time being. What do you mean by editing the command line? I simply entered the path to the ICM .jar file as thus:

Code: Select all

'/home/david/opt/internet connectivity monitor/InternetConnectivityMonitor.jar'
No, you cannot just link to data files there, you always have to have a command in the command line. Try this:

Code: Select all

xdg-open /home/david/opt/internet connectivity monitor/InternetConnectivityMonitor.jar

ginahoy
Level 3
Level 3
Posts: 188
Joined: Sun May 28, 2017 3:15 pm

Re: sorting out file associations

Post by ginahoy » Tue Nov 06, 2018 11:12 pm

Thanks for explaining how to set up the command in Launcher. I didn't consider that .jar is a data file, not an executable. It now works fine, so I'm done trying to troubleshoot the file association issue with shortcuts. I may come back to this later to satisfy my curiosity as to why it didn't work as expected.
Linux Mint 18.2 Xfce x64 | ASRock Z270 Extreme4 | Core i7 7700K | Cryorig H7 cooler| 32GB DDR4 2400| modded legacy Evercase LE4252 | EVGA 450W B3 | Samsung 850 EVO SSD

User avatar
BG405
Level 7
Level 7
Posts: 1859
Joined: Fri Mar 11, 2016 3:09 pm
Location: England

Re: sorting out file associations

Post by BG405 » Wed Nov 07, 2018 2:43 pm

Sorry to jump in, but did that actually work without escaping the spaces, i.e.:

Code: Select all

xdg-open /home/david/opt/internet\ connectivity\ monitor/InternetConnectivityMonitor.jar
..? :wink:

Also, for checking connectivity I use this:

Code: Select all

wget -O - https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python
I've created an alias for it in my .bashrc so just need to type "speedtest"; I do see that speedtest-cli is offered for installation via apt as well, as I just typed it on a machine without the alias in place. :)
Dell Inspiron 1525 - LM17.3 CE 64-------------------Lenovo T440 4GB - Manjaro KDE, LM17.3 KDE 32
Toshiba NB250 - Manjaro KDE------------------------K7S5A AMD 1.2GHz - LM17.3 Xfce 32 & WinXP-Pro
Acer Aspire E11 ES1-111M - LM18.2 KDE 64 ----Dell PII 350 64MB - Puppy 4.3 & Win98-SE

ginahoy
Level 3
Level 3
Posts: 188
Joined: Sun May 28, 2017 3:15 pm

Re: sorting out file associations

Post by ginahoy » Wed Nov 07, 2018 4:05 pm

BG405 wrote:
Wed Nov 07, 2018 2:43 pm
Sorry to jump in, but did that actually work without escaping the spaces
As shown in my previous post, I added quotes around the path, something I recall from XP. I wasn't aware of using forward slash to escape the spaces. Thanks.
Linux Mint 18.2 Xfce x64 | ASRock Z270 Extreme4 | Core i7 7700K | Cryorig H7 cooler| 32GB DDR4 2400| modded legacy Evercase LE4252 | EVGA 450W B3 | Samsung 850 EVO SSD

User avatar
BG405
Level 7
Level 7
Posts: 1859
Joined: Fri Mar 11, 2016 3:09 pm
Location: England

Re: sorting out file associations

Post by BG405 » Wed Nov 07, 2018 4:26 pm

I missed those, sorry! I do need my eyes checking though. Vision a bit off again today .. :| glad it's of some help. :)
Dell Inspiron 1525 - LM17.3 CE 64-------------------Lenovo T440 4GB - Manjaro KDE, LM17.3 KDE 32
Toshiba NB250 - Manjaro KDE------------------------K7S5A AMD 1.2GHz - LM17.3 Xfce 32 & WinXP-Pro
Acer Aspire E11 ES1-111M - LM18.2 KDE 64 ----Dell PII 350 64MB - Puppy 4.3 & Win98-SE

Post Reply

Return to “Newbie Questions”