linuxeclipseshellubuntueclipse-fp

Launch from GUI vs terminal - different path environment variable on Linux


Environment:

When opening EclipseFP by double clicking in Nemo file manager a custom tool named htfpp used by EclipseFP is not found. Error message: buildwrapper: could not execute: htfpp

htfpp executable is located in ~/.cabal/bin and ~/.cabal/bin is added to $PATH in .bashrc

Opening a terminal, navigating to the EclipeFP folder cd Software/EclipeFP and opening it with ./eclipse the plugin works correctly. This has the disadvantage that the terminal is kept open to keep EclipseFP open.

Writing a .sh script that does the above does not work though... it seems that when running the script from the GUI, Eclipse does not pick up the path correctly.

Opening the previous .sh shell from a terminal works though.

It seems this is related to the way Linux/Ubuntu/Cinnamon passes path environment variable to a running file from GUI vs terminal.

Any ideas how to open EclipseFP with the correct $PATH environment variable set using a shortcut and without leaving any terminal open while it is running?


Solution

  • The problem was that I was using a home relative path inside /etc/environment:

    PATH="/opt/ghc/7.8.2/bin:.cabal-sandbox/bin:~/.cabal/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
    

    the fix was to use an absolute path instead (/home/freeman/.cabal/bin instead of ~/.cabal/bin):

    PATH="/opt/ghc/7.8.2/bin:/home/freeman/.cabal-sandbox/bin:/home/freeman/.cabal/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
    

    After setting this and doing a restart opening eclipse executable directly from the GUI or a shortcut works correctly.