I referred this link for my problem: How to create launcher icon
Though my matlab icon is already created, whenever I click it this shows up for a few seconds:
Then, the application closes itself automatically!
I have to run it from the terminal every time for MATLAB to actually open and go beyond the splash screen:
Though the above method works perfectly, I want to be able to run it properly from the icon, I can't seem to figure out what the problem is.
As mentioned in the link above, of the top voted answer I did this first:
sudo ln /usr/share/app-install/desktop/matlab-support:matlab.desktop /usr/share/applications/matlab.desktop
Then deleted all the contents of the .matlab file and replaced it with:
[Desktop Entry] X-AppInstall-Package=matlab-support X-AppInstall-Popcon=4 X-AppInstall-Section=multiverse Version=1.0 Type=Application Terminal=false Exec=/usr/local/MATLAB/R2017a/bin/matlab -desktop Name=MATLAB Icon=/usr/share/app-install/icons/_usr_share_icons_hicolor_48x48_apps_matlab.png Categories=Development;Math;Science Comment=Scientific computing environment StartupNotify=true StartupWMClass=com-mathworks-util-PostVMInit X-Ubuntu-Gettext-Domain=app-install-data
When I retry doing the first step, I get the following message:
ln: failed to create hard link '/usr/share/applications/matlab.desktop': File exists
Then I tried creating a soft-link as suggested in one of the answers:
ln -s /usr/local/MATLAB/R2017a/bin/matlab /usr/local/bin/matlab
Nothing seems to work for me, help!