安装Java on Ubuntu 备忘

1. 确认当前版本:
rize@rize-laptop ~> java -version
java version "1.5.0_19"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02)
Java HotSpot(TM) Client VM (build 1.5.0_19-b02, mixed mode, sharing)

或者: to see the current configuration and possibilities.
rize@rize-laptop /u/l/lib> sudo update-java-alternatives -l
java-1.5.0-sun 53 /usr/lib/jvm/java-1.5.0-su

2。安装 java 6

Execute one of the following:

sudo apt-get install python-software-properties

sudo add-apt-repository ppa:sun-java-community-team/sun-java6

sudo apt-get update

sudo apt-get install sun-java6-jdk - For the JDK (Developer)
sudo apt-get install sun-java6-jre - For the JRE (User)

rize@rize-laptop /u/l/lib> java -version
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)

注: 可以改变默认的使用版本:  sudo update-java-alternatives -s java-6-sun

安装与配置IDE

  1. Eclipse的安装与配置

   1.1 从eclise.org下载Eclipse开发平台
         如类似以下的文件:eclipse-java-galileo-SR1-linux-gtk.tar.gz (没有下载)

    1.2 解压文件
         sudo mkdir /usr/local/dev
         sudo mkdir /usr/src/dev
         sudo cp
eclipse-java-galileo-SR1-linux-gtk.tar.gz /usr/src/dev/
         cd /usr/src/dev
         tar zxvf
eclipse-java-galileo-SR1-linux-gtk.tar.gz   -C /usr/local/dev

    1.3 建立一个Eclipse可执行文件
          sudo touch /usr/bin/eclipse
          sudo chmod 755 /usr/bin/eclipse
          sudoedit /usr/bin/eclipse

          内容如下:
         #!/bin/sh
          export ECLIPSE_HOME="/usr/local/dev/eclipse"
          $ECLIPSE_HOME/eclipse $*

          现在打开Terminal,执行"eclipse"应该能打开Eclipse了。

    1.4 添加Eclipse到Gnome菜单中
         sudoedit /usr/share/applications/eclipse.desktop
         内容如下:
         [Desktop Entry]
         Encoding=UTF-8
         Name=Eclipse-Rize
         Comment=Eclipse IDE
         Exec=eclipse
         Icon=/usr/local/dev/eclipse/icon.xpm
         Terminal=false
         Type=Application
         Categories=GNOME;Application;Development;
         StartupNotify=true



2. Netbeans的安装与配置   

2.1 从netbeans.org下载Netbeans开发平台
         如类似以下的文件: netbeans-6.7.1-ml-javase-linux.sh

    2.2 安装文件
         sudo cp netbeans-6.7.1-ml-javase-linux.sh /usr/src/dev/
         cd /usr/src/dev
         sudo chmod 755
netbeans-6.7.1-ml-javase-linux.sh
         sudo ./n
netbeans-6.7.1-ml-javase-linux.sh
         执行最后一步后,出现安装界面,选择安装目录和JDK的位置,确定后完成安装,在当前目录生成了“netbeans-6.0"目录,里面是Netbeans的内容。

    2.3 建立一个Netbeans可执行文件
          sudo touch /usr/local/bin/netbeans
          sudo chmod 755 /usr/local/bin/netbeans
          sudoedit /usr/local/bin/netbeans

          内容如下:
         #!/bin/sh
          #!/bin/sh
          export NETNEANS_PATH="/usr/local/netbeans-6.7.1/bin"
          $NETNEANS_PATH/netbeans $*


自动生成了快捷方式Netbeans到Gnome菜单中
/usr/share/applications/netbeans-6.7.1.desktop
[Desktop Entry]
Encoding=UTF-8
Name=NetBeans IDE 6.7.1
Exec=/bin/sh "/usr/local/netbeans-6.7.1/bin/netbeans"
Icon=/usr/local/netbeans-6.7.1/nb6.7/netbeans.png
Categories=Application;Development;Java;IDE
Version=1.0
StartupNotify=true
Type=Application
Terminal=0

你可能感兴趣的:(ubuntu)