Ubuntu中安装JDK
- 查找JDK安装路径
- 配置环境变量
查找JDK安装路径
首先,输入: which java
返回/usr/bin/java
然后file /usr/bin/java
返回/usr/bin/java: symbolic link to/etc/alternatives/java'
/usr/lib/jvm/jdk1.7.0_45/bin/java’
然后file /etc/alternatives/java
返回/etc/alternatives/java: symbolic link to
然后file /usr/lib/jvm/jdk1.7.0_45/bin/java
返回/usr/lib/jvm/jdk1.7.0_45/bin/java: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux2.6.9,BuildID[sha1]=0x68582ab83ddaf6429310a6f841f0adda165ce880, not stripped
说明路径是/usr/lib/jvm/jdk1.7.0_45/bin
配置环境变量
有sudo gedit /etc/profile 修改系统文件
和sudo gedit ~/.bashrc修改系统文件,会覆盖profile的设置有时候,你已经安装了jdk,但是在使用的时候还是说找不到Java_Home的配置,说明bashrc的配置没有变更回来。