[Ubuntu].desktop file. “There was an error lunching the application”
设置Eclipse启动图标时,编写**.desktop** 文件,在启动栏找不到图标,并且在目录下也无法启动,显示信息:
“There was an error lunching the application”
解决办法:运行desktop-file-validate
对文件错误信息进行调试。
cd /usr/share/applications
desktop-file-validate eclipse.desktop
.desktop file set-up
- 进入applications目录
cd /usr/share/applications
- 编写文件
sudo vim eclipse.desktop
add text :
[Desktop Entry]
Name=Eclipse
Comment=eclipse
Exec=/usr/local/eclipse/eclipse
Icon=/usr/local/eclipse/icon.xpm
Terminal=false
StartupNotify=true
Type=Application
Categories=Application;Development;
- 调试
运行出现错误信息:
“There was an error lunching the application”
debug:
/applications$ desktop-file-validate eclipse.desktop
eclipse.desktop: error: line "[Desktop Entry] " ends with a space, but looks like a group. The validation will continue, with the trailing spaces ignored.
eclipse.desktop: warning: value "eclipse " for key "Comment" in group "Desktop Entry" looks redundant with value "Eclipse " of key "Name"
eclipse.desktop: error: value "false " for boolean key "Terminal" in group "Desktop Entry" contains invalid characters, boolean values must be "false" or "true"
eclipse.desktop: error: value "true " for boolean key "StartupNotify" in group "Desktop Entry" contains invalid characters, boolean values must be "false" or "true"
eclipse.desktop: error: value "Application " for key "Type" in group "Desktop Entry" is not a registered type value ("Application", "Link" and "Directory")
eclipse.desktop: warning: value "Application;Development; " for key "Categories" in group "Desktop Entry" contains a deprecated value "Application"
eclipse.desktop: error: value "Application;Development; " for key "Categories" in group "Desktop Entry" contains an unregistered value " "; values extending the format should start with "X-"
发现错误,所有语句后面都多了空格,导致命令信息错误。把多余空格信息删除,重新运行成功。
4. 测试通过
打开程序栏,输入eclipse,成功运行。
总结
- .desktop文件不会自动忽略空格,多余空格导致命令错误。
- .desktop文件可以用
desktop-file-validate
调试