Issue
I have been looking up ways to create a launcher of sorts so that environment variables are set when I run the Eclipse app on mac.
When I run the app from terminal, the environment variables are properly set since the bash script has them; however, when I run the app directly, it doesn't have them. I have looked at automator and eclipse settings but cannot seem to find a simple way of doing it. This is important because when I do maven install, the paths are not correct. I could set environment variables every time I do run but that seems tedious. Any ideas?
Solution
You could have the .app call an executable loader script, which can set environment variables and call the executable binary. The script is placed in Contents/MacOS/. If you swap names with the main exec. binary, Info.plist will already point to it, then call the renamed binary from the loader script.
#!/usr/bin/env bash
cd "$(dirname "$0")" || exit 1
cwd="$(pwd)"
export VARIABLE=808
exec "${cwd}/myapp"
Answered By - Richard Barber
Answer Checked By - Katrina (JavaFixing Volunteer)