Results 1 to 5 of 5

Thread: Can't Run Program from the KDE Menu but can run it from command line

  1. #1

    Default Can't Run Program from the KDE Menu but can run it from command line

    I've been using jEdit as my main text editor for my major editing along with Kate for quick text file views.

    Today I messed around installing JDownloader and part of the issues I had I thought had to do with Java, so I uninstalled the openjdk version and installed Oracle Java in a non-standard place. Then I had more issues with getting things to work, so I installed another version of Java I downloaded from a third party source that handled the update-alternatives install. Anyway, after messing around and figuring out how to set the Java_HOME variable and adding Java to the PATH variable, I managed to get jEdit to run again from the command line with no problem.

    But jEdit will NOT run from the KDE menu any more like it used to. It just pops up the executing icon, then dies. No error messages or anything. Again, run from the command line it runs fine.

    I examined the jedit shell script which is pretty simple. It just tries to find the JVM using $JAVA_HOME or if that doesn't exist it uses `which java` and then runs the following exec command:

    exec "$JAVA" -jar /usr/share/jedit/jedit.jar -reuseview "$@"

    As I say, this runs fine from the command line. But it won't finish execution from the KDE menu.

    I messed around with the KDE menu entry to try to see what was wrong, but nothing works. It's now back to the way it was: the command to execute is a simple "jedit %U", which worked fine before.

    The jEdit shell script to launch it is located in /use/bin/ and is named simply jedit. It looks like this:

    Code:
    #!/bin/sh
    #
    # Runs jEdit
    #
    # You can specify which Java installation to use through the JAVA_HOME
    # environment variable. Otherwise, this will look for Java in the
    # system PATH.
    #
    # You can set a global value for JAVA_HOME in /etc/environment.
    
    if [ -z "$JAVA_HOME" ]; then
        JAVA=`which java 2>/dev/null`
        if [ -z "$JAVA" ]; then
            echo "Failed to find the java virtual machine! Bailing..."
            exit 1
        fi
    else
        JAVA="$JAVA_HOME/bin/java"
    fi
    echo $JAVA
    exec "$JAVA" -jar /usr/share/jedit/jedit.jar -reuseview "$@"
    The jEdit desktop entry in /use/share/ is:

    Code:
    [Desktop Entry]
    X-SuSE-translate=true
    Name=jEdit
    GenericName=Programmer's Text Editor
    Comment=Edit text files
    Exec=jedit %U
    Icon=jedit
    Terminal=false
    Type=Application
    Categories=Utility;TextEditor;
    StartupNotify=true
    MimeType=text/plain;
    X-Desktop-File-Install-Version=0.22
    It seems to me that the menu should simply execute the command "jedit %U" which should search the $PATH variable until it finds the jedit shell script in /usr/bin and then it should run it and it should work exactly as if run from the command line.

    What am I missing here?

  2. #2

    Default Re: Can't Run Program from the KDE Menu but can run it from command line

    Quote Originally Posted by richardstevenhack View Post
    What am I missing here?
    Have you logged out and in again after messing around with your Java installation?

    Maybe $JAVA_HOME has changed, but the change is not reflected in KDE's environment, so when the script is called from the menu, $JAVA_HOME might still be set to the old value.

  3. #3

    Default Re: Can't Run Program from the KDE Menu but can run it from command line

    I'm pretty sure I did at one point, but I'll do it again to test.

  4. #4

    Default Re: Can't Run Program from the KDE Menu but can run it from command line

    HAH! That was it! After logging out and in, now the menu entry runs fine as before.

    I'd really be interested in finding exactly where in KDE that information wasn't being updated before another login. I've looked at the whole KDE menu/desktop entries thing before but found it way too confusing based on the scattered documentation (which also seems to change in KDE with each release.) I'll have to remember this next time. I should know by now that when I mess around like this, a logout and login if not a reboot is always a good idea.

    Thanks for your help!

  5. #5

    Default Re: Can't Run Program from the KDE Menu but can run it from command line

    Quote Originally Posted by richardstevenhack View Post
    HAH! That was it! After logging out and in, now the menu entry runs fine as before.
    Good to hear.

    I'd really be interested in finding exactly where in KDE that information wasn't being updated before another login.
    If you set an environment variable, this only applies to the current shell (and children of it), not to already running processes.
    KDE itself has absolutely no information about $JAVA_HOME or other environment variables.

    KDE does cache which menu entries (.desktop files) are available, you can force refreshing this cache with "kbuildsycoca4"
    But this doesn't seem to have been the problem here at all.

    I've looked at the whole KDE menu/desktop entries thing before but found it way too confusing based on the scattered documentation (which also seems to change in KDE with each release.)
    ??? This does not change at all with each KDE release, and it is no KDE thing but a freedesktop.org standard.
    See here: http://standards.freedesktop.org/des...y-spec/latest/

    I'll have to remember this next time. I should know by now that when I mess around like this, a logout and login if not a reboot is always a good idea.
    Depends on what you do of course.
    If you change important environment variables, you'll have to logout/login (or even reboot) though to make sure _all_ processes are seeing the new values.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •