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

2
  • Does the ksh script fork processes for each Java program? Commented Feb 21, 2018 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. Commented Feb 21, 2018 at 17:30

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.