How can I, in Java or using some other programming language, add a new program group in the applications menu in both KDE and Gnome?
I am testing with Ubuntu and Kubuntu 8. Putting a simple .menu file in ~/.config/menus/applications-merged worked in Kubuntu, but the same procedure does nothing in Ubuntu.
The content of my file is as follows:
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN" "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
<Menu>
<Menu>
<Name>My Program Group</Name>
<Include>
<Filename>shortcut.desktop</Filename>
</Include>
</Menu>
</Menu>
Note that the .desktop file is correctly placed in ~/.local/share/applications.
Ps: The original question did not specify I wanted a solution in a programmatic way.