We have Java 7 installed in our linux server but for a specific shell script, want to use a different version and execute. Below is the code I have in shell script, when I execute the shell script, it is not using the new java path set in the file. how can I set the java home for running this script?
#!/bin/bash
export JAVA_HOME=/data/....
export PATH=$JAVA_HOME/bin:$PATH
JAVA=`which java`
$JAVA -cp DataLoader.jar com.salesforce.dataloader.security.EncryptionUtil 1 Answer
Find where the Java (version) is installed first. They are commonly located at /usr/lib/jvm.
For example I've Java 8 and want to specifically execute with it.
#!/usr/bin/env bash
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -cp DataLoader.jar com.salesforce.dataloader.security.EncryptionUtilIf you have some bash scripting experience you can save this path in a variable and use it with it.