我已经用这个命令下载了 Java 10:
sudo add-apt-repository ppa:linuxuprising/java
sudo apt-get update
sudo apt-get install oracle-java10-installer
sudo apt-get install oracle-java10-set-default
安装成功,通过java -version
可以看到Java版本
但是当我在 tomcat.service
文件中更改
Environment=JAVA_HOME=/usr/lib/jvm/java-10-oracle/
我不能再运行 Tomcat。但是,它适用于通过 sudo apt-get install default-jdk
命令安装的 Java 8:
Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre
最佳答案
好的。我建议使用 Java 8 或 9。即使 Tomcat 说 Tomcat 9 可以支持 Java 8 和更高版本更好地稳定而不是 las JRE。
来自 Tomcat site :
Users were successfully running Tomcat 8 on Java 8 many months before the first stable Java 8 release. However, users of early access builds should be aware of the following:
It is not unusual for the initial early access builds to contain bugs that can cause problems for web applications running on Tomcat.
If the new Java version introduces new language features then the default JSP compiler may not support them immediately. Switching the JSP compiler to javac may enable these new language features to be used in JSPs.
If you do discover an problem using a Java early access build, please ask for help. The Tomcat user's mailing list is probably the best place to start.
关于java - Tomcat 9 无法在 Ubuntu 上使用 Java 10,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50948436/