ubuntu14.04 installing JDK and TOMCAT7 eclipse

Source: Internet
Author: User
Tags gz file

I. Installing the JDK:

  1. Download JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html Note that the downloaded file ends in tar.gz, for example: jdk-7u21-linux-i586.tar.gz
  2. Unzip: I created a new Javadev directory in the home directory to hold Java related software.
    sudo tar-zxvf/home/hsiung/download/jdkxxxx.tar.gz-c/home/hsiung/javadev/
  3. Setting environment variables
    Note that many of the online tutorials are to copy or move the JDK folder to the USR folder, this is not necessary, as long as the path path to configure the correct JDK path on the line, so no need to move.

    Access to the root account can also be used by ordinary users
    sudo-s//Open the. bashrc file with the editor
    Gedit. BASHRC under the ordinary user Note add sudo
    Add the environment variable as above in the last line (file location according to your actual situation)

    Export java_home=/home/hsiung/javadev/jdk1.7.0_67
    Export JRE_HOME=${JAVA_HOME}/JRE
    Export Classpath=.:${java_home}/lib:${jre_home}/lib
    Export Path=${java_home}/bin: $PATH

    Restart or logoff takes effect.

  4. Configure the default JDK version (to replace OPENJDK)

    Open the terminal, just open it anywhere, and then execute the command in turn.

    sudo update-alternatives--install /home/hsiung/javadev/bin /java

    sudo update-alternatives--install /home/hsiung/javadev/bin /javac

    sudo update-alternatives--install /home/hsiung/javadev/bin /jar

    sudo update-alternatives--install /home/hsiung/javadev/bin /javah

    sudo update-alternatives--install /home/hsiung/javadev/bin /javap

    You only need to replace the path of the blue portion of the upper part of the bin directory under your JDK . Pay attention to one sentence of execution!

    Finally, execute the command below:

    sudo update-alternatives--config java

    If you first install the JDK, you will be prompted

    Thereis only one alternative in link Group Java (providing/usr/bin/java):/home/apples/javadevelop/jdk-7u21-linux-i586/ Bin/java

    No configuration required.

    For non-initial installation, there will be different versions of the JDK option.

  5. Test:
    Check that the command output is correct
    Echo $JAVA _home
    Echo $JRE _home
    Echo $PATH
    Java-version

Two. Install Tomcat

  1. Download: http://tomcat.apache.org/ Download the tar.gz file below the core. Tomcat 7.
  2. Unzip, ibid. Or in the Javadev directory. And finally the/javadev/tomcat7/.
  3. Configuring the Environment

    Open the Tomcat directory and go to the bin directory. sudo gedit open startup.sh, added at the end

    Java_home= your Java path

    Path= $JAVA _home/bin: $PATH

    Classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

    Tomcat_home= /HOME/HSIUNG//JAVADEV/TOMCAT7

  4. Modify Permissions
    Many people will encounter this problem:

    Ubuntu under Tomcat does not start, prompting

    Neither the Java_home nor the JRE_HOME environment variable is defined
    At least one of these environment variable are needed to run this program
    If the Java test output is correct, then the permissions are insufficient.
    ~# chmod 777/home/hsiung/javadev/tomcat7-r//Note is root

  5. Start
    /home/hsiung/javadev/tomcat7/bin/startup.sh


    Output:
    Using catalina_base:/HOME/HSIUNG/JAVADEV/TOMCAT7
    Using Catalina_home:/HOME/HSIUNG/JAVADEV/TOMCAT7
    Using Catalina_tmpdir:/home/hsiung/javadev/tomcat7/temp
    Using Jre_home:/home/hsiung/javadev/jdk1.7.0_67/jre
    Using CLASSPATH:/home/hsiung/javadev/tomcat7/bin/bootstrap.jar:/home/hsiung/javadev/tomcat7/bin/tomcat-juli.jar
    Tomcat started.
  6. Once the server is started, you can enter it in the browser: http://localhost:8080 will be able to see the Tomcat Welcome page.

Turn Tomcat off: under the Tomcat/bin directory
sudo./shutdown.sh
Three. Install Eclipse

  1. Download http://www.eclipse.org/downloads/

    If you need to develop JSP website can download Java EE version, or download javase version
    I downloaded the Java EE version: Eclipse IDE for Java eedevelopers, choose your current ubuntu corresponding number of digits

  2. Unzip ibid.
  3. Click Eclipse to run it. Here's a common error:a Java Runtime environment (JRE) or Java development Kit (JDK)
    Must is available in order to run Eclipse. No Java virtual machine is found after searching the following locations:
    /home/hsiung/javadev/eclipse/jre/bin/java Java in your current PATH
    Workaround:
    Open terminal input in the Eclipse directory:
    mkdir JRE
    CD JRE
    Ln-s /home/hsiung/javadev/jdk1.7.0_67/bin bin//Red is your JDK directory
  4. Creating Eclipse shortcuts on the desktop

    Create a new blank file on the desktop, named: eclipse.desktop

    Open the newly created Eclipse.desktop file with sudo gedit, and paste the following inside:

    [Desktopentry]

    Encoding=utf-8

    Name=eclipseplatfrom

    Comment=eclipseide

    exec= /home/hsiung/javadev/eclipse/eclipse

    icon= /home/hsiung/javadev/eclipse/icon.xpm

    Terminal=false

    Startupnotify=true

    Type=application

    Categories=application;development;

    Name[zh_cn]=eclipse

ubuntu14.04 installing JDK and TOMCAT7 eclipse

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.