In .bashrc and .profile I have my QHOME variable set to the directory that contains k4.lic, l64, q.k (validated by echo $QHOME).
When I startup q from the login shell all works fine, the license file is found.
When I start a q process programmaticaly from java, then I get the following output
[13:43:48][Step 1/2] WARN [main] (QSession.java:78) - Q Session not alive
[13:43:48][Step 1/2] INFO [main] (QSession.java:97) - QHOME: null
[13:43:48][Step 1/2] INFO [main] (QSession.java:98) - QLIC: null
[13:43:48][Step 1/2] ERROR [main] (QSession.java:101) - Error output
[13:43:48][Step 1/2] '2018.02.06T13:43:46.597 k4.lic
i.e. the license is not found because the QHOME env variable is undefined. This problem is described here: ".bashrc is only sourced in a login shell". The proposed solution is
"If you want a variable to be set in all Bourne shell derivatives regardless of whether they are interactive or not, put it in both .profile and .bashrc."
But I have already copied the content of .bashrc into .profile and still get the same error.
Unfortunately, there is no way to pass the path to the license as a command line argument for the q binary, so I have to work with QHOME.
What I could do is put a 32-bit version in my java project but obviously it is advantageous to use the 64-bit version.
Suggestions much appreciated!
Thanks
Thanks to @Jonathan McMurray! The exact solution is to use
where
commandis for exampleq -p 5000andenvpis for example