How do I make a desktop icon to launch a program?

Have an interesting issue. I am VERY new to Ubuntu and Linux systems. I have only been running linux on my laptop for a couple of months. Here is what I am trying to do - I recently installed google earth and am trying to make a desktop icon for it. With other programs I have installed I have been able to copy the executable file from /usr/share/applications and then paste in the desktop folder. However google earth does not show in that folder and has a different way of loading. I tried copying the file like I did before but it pulls up as a text file. What I would like to do is create a very small executable file that I can put on the desktop to launch google earth. I found the command line for it is :

/opt/google/earth/free/google-earth %f

Is there a way to write this into a executable file easily? Be aware I am very new and still learning. So be desciptive as possible, please. I am starting to understand the code, but still struggle at times.

One last question, how do I change an icon image? I am not seeing the setting to change it.

Thanks


You have to create in your desktop directory (usually ~/Desktop) a .desktop file, let say google_earth.desktop with the following content inside:

[Desktop Entry]
Version=1.0
Name=Google Earth       
Comment=Open Google Earth
Exec=/opt/google/earth/free/google-earth %f
Icon=google-earth
Terminal=false
Type=Application
Categories=Utility;Application;

Don't forget to make it executable. You can do this from terminal using the following command:

chmod +x ~/Desktop/google_earth.desktop

See also how to create a .desktop file using a text editor.