How can I run an application with a specific Java version? I have three Java versions intstalled:
myuser@mysystem:~$ sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).
  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      auto mode
* 1            /opt/jdk-9.0.4/bin/java                          1         manual mode
  2            /opt/jdk1.8.0_162/bin/java                       1         manual mode
  3            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode
I have Java 9 set as default and I'd like to keep it that way. Still, an application named pdfsam doesn't seem to work properly with Java 9. What command is necessary to run it with openjdk (option 3)?
You can run java with the absolute path to the installation
This would be your default /usr/bin/java installation
java -version
To change it, use the absolute path
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -version
If you're not running the java command directly, try setting the JAVA_HOME variable:
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre/" pdfsam
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With