Ubuntu – Launching Scratch in Ubuntu problem

16.04

How to install Scratch 2 on Ubuntu 16.10. or 17.04 (64bit)?

Have followed the code by Martin but permission is denied and no such file exists messages appear.

The first bit of code seems to have worked so I have the scratch.air file

Any help appreciated – code I've tried is below :

Create launcher:

$ cat << _EOF_ > /usr/share/applications/Scratch2.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=/opt/adobe-air-sdk/adobe-air/adobe-air /opt/adobe-air-sdk/scratch/Scratch-456.0.1.air
Icon=/opt/adobe-air-sdk/scratch/scratch.png
Terminal=false
Name=Scratch 2
Comment=Programming system and content development tool
Categories=Application;Education;Development;ComputerScience;
MimeType=application/x-scratch-project
_EOF_

$ chmod +x /usr/share/applications/Scratch2.desktop

Best Answer

Normally, the /usr/share/applications directory is owned by root - you won't be able to cat to a file there without sudo. You can either modify the here-doc command to

cat << _EOF_ | sudo tee /usr/share/applications/Scratch2.desktop

or just use an editor to create the .desktop file instead

sudoedit /usr/share/applications/Scratch2.desktop

FWIW I don't believe .desktop files need execute permission, but if they did you would need sudo to change that as well

sudo chmod +x /usr/share/applications/Scratch2.desktop
Related Question