Ubuntu 18.04 XAMPP desktop icon "There was an error launching the application"

9,606

This worked for me on Ubuntu 18.04.

First you need to install the package "nautilus-admin":

sudo apt-get update
sudo apt-get install nautilus-admin

Create a new file in "/usr/share/polkit-1/actions/xampp.policy" with:

sudo nano /usr/share/polkit-1/actions/xampp.policy

Add this content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
 "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>

  <action id="org.freedesktop.policykit.pkexec.run-xampp">
    <description>Run the Xampp Control Panel</description>
    <message>Authentication is required to run the Xampp Control Panel</message>
    <defaults>
      <allow_any>no</allow_any>
      <allow_inactive>no</allow_inactive>
      <allow_active>auth_admin_keep</allow_active>
    </defaults>
    <annotate key="org.freedesktop.policykit.exec.path">/opt/lampp/manager-linux-x64.run</annotate>
    <annotate key="org.freedesktop.policykit.exec.allow_gui">TRUE</annotate>
  </action>
</policyconfig>

To end, create a new file or edit the desktop entry on /usr/share/applications/xampp-control-panel.desktop and replace Exec=gksudo /opt/lampp/manager-linux-x64.run with Exec=pkexec /opt/lampp/manager-linux-x64.run:

sudo nano /usr/share/applications/xampp-control-panel.desktop

[Desktop Entry]
Encoding=UTF-8
Name=XAMPP Control Panel
Comment=Start and Stop XAMPP
Exec=pkexec /opt/lampp/manager-linux-x64.run
Icon=/opt/lampp/htdocs/favicon.ico
Categories=Application
Type=Application
Terminal=false

I hope it helps.

Share:
9,606

Related videos on Youtube

eric
Author by

eric

Updated on September 18, 2022

Comments

  • eric
    eric over 1 year

    I created an icon on the desktop and entered the following code:

    [Desktop Entry]
    Encoding=UTF-8
    Name=XAMPP Control Panel
    Comment=Start and Stop XAMPP
    Exec=gksudo /opt/lampp/manager-linux-x64.run
    Icon=/opt/lampp/htdocs/favicon.ico
    Categories=Application
    Type=Application
    Terminal=false
    

    When I launch the application I get "There was an error launching the application"

    If I go into the terminal and type sudo /opt/lampp/manager-linux-x64.run, it works fine. I tried changing gksudo to sudo but that didn't work either.

    What am I doing wrong?

  • Jude Fernandes
    Jude Fernandes almost 5 years
    Tried on ubuntu 19, the only one that works perfectly without gksu or gksudo. Thank you!!.
  • PhatHV
    PhatHV over 3 years
    I confirmed it also works in Ubuntu 20.04.