What is it? @.@

Here is the place where I record some tactics about wargame, systems, and other security issues.

2012-11-24

Install Oracle Java SE 7 JDK & Eclipse 4.2.1 (Juno) in Ubuntu 12.04

[Java Platform, Standard Edition Development Kit (JDK)]


Introduction:

Installation:
  1. [Comment] Download the tarball and extract it
  2. [Comment] First, visit the download page and choose the one suitable for your system



  3. sp@simple-plan:~$ tar -zxvf jdk-7u9-linux-i586.tar.gz
  4. [Comment] Install Java
  5. sp@simple-plan:~$ sudo mkdir -p /usr/local/jvm
  6. sp@simple-plan:~$ sudo mv ./jdk1.7.0_09 /usr/local/jvm

Linking relationship:
  1. [Comment] Maintain symbolic links
  2. sp@simple-plan:~$ sudo update-alternatives --install /usr/local/bin/javac javac /usr/local/jvm/jdk1.7.0_09/bin/javac 1
  3. sp@simple-plan:~$ sudo update-alternatives --install /usr/local/bin/java java /usr/local/jvm/jdk1.7.0_09/bin/java 1
  4. sp@simple-plan:~$ sudo update-alternatives --install /usr/local/bin/jar jar
    /usr/local/jvm/jdk1.7.0_09/bin/jar 1
  5. [Comment] If you have multiple version of JDK in the system, you could config them
  6. sp@simple-plan:~sudo update-alternatives --config javac
  7. sp@simple-plan:~sudo update-alternatives --config java
  8. sp@simple-plan:~sudo update-alternatives --config jar

Setting Java home path:
  1. [Comment] Configure Java home path
  2. sp@simple-plan:~$ vim ~/.bashrc
    # Append the configures to the file
    ...
    JAVA_HOME=/usr/local/jvm/jdk1.7.0_09/
    export JAVA_HOME
    JRE_HOME=/usr/local/jvm/jdk1.7.0_09/jre
    export JRE_HOME
    CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
    export CLASSPATH
    PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
    export PATH
    ...
  3. sp@simple-plan:~source ~/.bashrc
  4. [Comment] Add man path
  5. sp@simple-plan:~$ sudo vim /etc/manpath.config
    ...
    19 #
    20 MANDATORY_MANPATH         /usr/man
    21 MANDATORY_MANPATH         /usr/share/man
    22 MANDATORY_MANPATH         /usr/local/share/man
    23 MANDATORY_MANPATH         /usr/local/jvm/jdk1.7.0_09/man
    24 #---------------------------------------------------------
    ...

Checking version:
  1. [Comment] Java version test
  2. sp@simple-plan:~java -version
    java version "1.7.0_09"
    Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
    Java HotSpot(TM) Client VM (build 23.5-b02, mixed mode)

Uninstall Java SE 7 JDK:
  1. [Comment] Remove  Java directory
  2. sp@simple-plan:~$ sudo rm -rf /usr/local/jvm/jdk1.7.0_09/
  3. [Comment] Remove  links of Java
  4. sp@simple-plan:~sudo update-alternatives --remove javac /usr/local/jvm/jdk1.7.0_09/bin/javac
  5. sp@simple-plan:~sudo update-alternatives --remove java /usr/local/jvm/jdk1.7.0_09/bin/java
  6. sp@simple-plan:~sudo update-alternatives --remove jar /usr/local/jvm/jdk1.7.0_09/bin/jar


[Eclipse 4.2.1 (Juno)]

Introduction:

Installation:
  1. [Comment] Download the tarball and extract it.
  2. sp@simple-plan:~$ tar -zxvf eclipse-SDK-4.2.1-linux-gtk.tar.gz
  3. [Comment] Move eclipse to an appropriate directory
  4. sp@simple-plan:~$ sudo mv ./eclipse /opt/
  5. [Comment] Make a link
  6. sp@simple-plan:~sudo update-alternatives --install /usr/bin/eclipse eclipse /opt/eclipse/eclipse 1
  7. [Comment] Add eclipse to unity
  8. sp@simple-plan:~$ sudo vim /usr/share/applications/eclipse.desktop
    # Add the following into the file

    [Desktop Entry]
    Version=4.2
    Name=Eclipse
    Comment=Java Integrated Development Environment
    Exec=/opt/eclipse/eclipse
    Type=Application
    Icon=/opt/eclipse/icon.xpm
    Terminal=false
    NoDisplay=false
    Categories=Java;Development;IDE

Uninstall Eclipse:
  1. [Comment] Remove eclipse directory
  2. sp@simple-plan:~$ sudo rm -rf /opt/eclipse
  3. [Comment] Remove links of eclipse
  4. sp@simple-plan:~sudo update-alternatives --remove eclipse /opt/eclipse/eclipse
  5. sp@simple-plan:~$ sudo rm -rf /usr/share/applications/eclipse.desktop


No comments:

Post a Comment