在 Ubuntu 中,我设置了 jdk 环境(JAVA_HOME,JRE_HOME),并且 java -version 可以使用。但我可以启动tomcat。一些信息:
- JAVA_HOME 和 JRE_HOME 环境变量均未定义
- 至少需要其中一个环境变量才能运行此程序
环境设置/etc/profile
JAVA_HOME=/opt/jvm/java/jdk1.7.0_25
JRE_HOME=/opt/jvm/java/jdk1.7.0_25/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME
export JAVA_HOME
export JRE_HOME
export PATH
日志
sunshanming@sunshanming-vm1:~$ sudo /opt/apache-tomcat-7.0.42/bin/startup.sh
[sudo] password for sunshanming:
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
sunshanming@sunshanming-vm1:~$ echo $JAVA_HOME
/opt/jvm/java/jdk1.7.0_25
sunshanming@sunshanming-vm1:~$ echo $JRE_HOME
/opt/jvm/java/jdk1.7.0_25/jre
sunshanming@sunshanming-vm1:~$ java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)