问题描述
如何运行具有特定 Java 版本的应用程序?我安装了三个 Java 版本:
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
我将 Java 9 设置为默认值,我想保持这种状态.尽管如此,名为 pdfsam
的应用程序似乎无法在 Java 9 中正常运行.使用 openjdk(选项 3)运行它需要什么命令?
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)?
推荐答案
您可以使用安装的绝对路径运行 java
You can run java
with the absolute path to the installation
这将是您默认的 /usr/bin/java
安装
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
如果您没有直接运行 java
命令,请尝试设置 JAVA_HOME 变量:
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
这篇关于如何在特定 Java 版本上运行应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!