vim /etc/profile
添加如下内容:JAVA_HOME根据实际目录来
JAVA_HOME=/usr/java/jdk1.8.0_60
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH
Esc :wq 保存并退出
- 7、重启机器:sudo shutdown -r now或执行命令 :source /etc/profile
- 8、查看安装情况:java -version
- 9、Tomcat安装
安装tomcat备注:
1、执行unzip命令时报:The program 'unzip' is currently not installed. You can install it by typing: apt install unzip
接着执行apt install unzip时报:Unable to locate package
要先更新软件源:sudo apt-get update
再安装unzip,再解压就O了
2、bin目录下执行chmod +x *.sh 增加sh文件的可执行权限
3、wget http://localhost:port测试
openJDK:sudo apt-get install oracle-java8-installer