1. 程式人生 > >Ubuntu下安裝jdk1.8和eclipse

Ubuntu下安裝jdk1.8和eclipse

clas 通過 etc style not des port false class

配置jdk參考https://www.linuxidc.com/Linux/2017-02/140908.htm

需要配置/etc/environment,配置完如下所示

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$JAVA_HOME/bin"
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export JAVA_HOME=/opt/jvm/jdk1.8.0_191

再通過source /etc/environment生效

還要配置/etc/profile,配置完如下所示

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "$PS1" ]; then
  if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1=\h:\w\$ 
    if [ -f /etc/bash.bashrc ]; then
      . 
/etc/bash.bashrc fi else if [ "`id -u`" -eq 0 ]; then PS1=# else PS1=$ fi fi fi if [ -d /etc/profile.d ]; then for i in /etc/profile.d/*.sh; do if [ -r $i ]; then . $i fi done unset i fi #set Java environment export JAVA_HOME=/opt/jvm/jdk1.8.0_191 export JRE_HOME=$JAVA_HOME/jre export CLASSPATH=.:$JAVA_HOME/lib:$JAR_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

同樣通過source /etc/profile生效

安裝eclipse參考https://blog.csdn.net/qq_37549757/article/details/56012895

首先通過解壓命令

sudo tar zxvf eclipse-inst-linux64.tar.gz -C /opt/ 

解壓到/opt目錄下,然後

cd /usr/share/applications

再然後

sudo vim eclipse.desktop 

輸入如下內容

[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse
Exec=/opt/eclipse-installer/eclipse-inst
Icon=/opt/eclipse-installer/icon.xpm
Terminal=false
StartupNotify=true
Type=Application
Catagories=Application;Development;

再輸入命令

sudo chmod u+x eclipse.desktop

然後將圖標從/usr/share/applications粘貼到桌面打開安裝即可。

Ubuntu下安裝jdk1.8和eclipse