3

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

Thomas Smyth - Treliant
  • 4,993
  • 6
  • 25
  • 36
tenticon
  • 2,639
  • 4
  • 32
  • 76
  • Assuming you are using something like the Java `exec` method to run the Q process, I think you should adjust the command you are running to include the `QHOME` variable e.g. `exec("QHOME=/path/to/licence q")` instead of `exec(q)` – Jonathon McMurray Feb 06 '18 at 15:35

1 Answers1

2

Thanks to @Jonathan McMurray! The exact solution is to use

Runtime.getRuntime().exec(command, envp);

where command is for example q -p 5000 and envp is for example

String[] envp = {"QHOME="+qHomePath};
tenticon
  • 2,639
  • 4
  • 32
  • 76