Ubuntu 18.04 XAMPP desktop icon "There was an error launching the application"
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.