1

Just to be clear, I DON'T WANT to change the JAVA_HOME during a java command (and take this change into account for said command), but I'm facing a situation where several java commands can be run simultaneously from some ksh scripts, and in those scripts JAVA_HOME is set (and exported) to either a 32-bits or 64-bits version before executing the java command itself.

So I am concerned there could be some "clashes" of some sort... Any advice on how to avoid any "overlaps", if they are even possible?

Note: there can potentially be a lot of script executions at the same time, and >the commands run with 32-bits version of Java cannot be run with 64-bits >version of Java for compatibility issues with other-party processes

Thanks in advance

Sakhri Houssem
  • 975
  • 2
  • 16
  • 32
Coystt
  • 51
  • 3
  • Does the ksh script fork processes for each Java program? – Code-Apprentice Feb 21 '18 at 17:21
  • Java makes no use of JAVA_HOME. It is used by some IDEs, Tomcat, etc. Java provides no way of changing environment variables. An environment variable change in the parent process isn't visible from a child process. Unclear what you're asking. – user207421 Feb 21 '18 at 17:30

2 Answers2

0

JAVA_HOME is just a convention and it has no effect on the running JVM.

You can set the JAVA_HOME safely for each script, however do not use export! or you might end up with unexpected results.

Also, usually, the java application is located at JAVA_HOME/bin so you need to make sure that your script is pointing to the correct JVM 32/64. HTH, Gal.

Gal Nitzan
  • 391
  • 2
  • 12
0

Like all environment variables, it's fixed at the start of the command. See, for example, this question (it's about a Python program, but the same concept applies).

However, as others have pointed out, it doesn't actually have any effect on Java commands.

Brian McCutchon
  • 8,354
  • 3
  • 33
  • 45