Ubuntu 14.04 Installation Jdk,tomcat

Source: Internet
Author: User

From: http://blog.csdn.net/carlos1992/article/details/43085897

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Write in front:

installed, referring to a lot of online information, there are a lot of people to write some simple, others over the version of a little update, like me small white can not find the cardinal point, tossing for two days, just to get a why. So, here, I write down the whole process of myself in detail. So that everyone can make a reference.

To install the JDK:

First of all, we want Baidu "jdk", download on the official website. Here is the address I downloaded: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

I choose to be jdk-8u31-linux-x64.tar.gz. Because it's an Ubuntu system. Do not select the RPM suffix, which is used by Red Hat Linux.

When I download it, I use the default path of the browser, which is the "Downloads" folder.

Here, I refer to a Baidu experience, I just do this, but, in the middle there is a little place, need to remind. The address of this Baidu experience:

Http://jingyan.baidu.com/article/647f0115bb26817f2048a871.html

Create a directory/USR/LIB/JVM in order to put the downloaded package into this directory.

Unzip and place the extracted jdk1.8.0_25 folder in the/USR/LIB/JVM directory. Note: I am now downloading the installation package in the desktop directory so directly in the desktop directory under Operation, if you downloaded the installation package is not in the Desktop directory, please first CD into the appropriate directory, and then continue to operate.

(Explanation: Here, different times, download the JDK version is not the same, just need to put the name of the good. For example, when I download, the version is jdk-8u31-linux-x64.tar.gz, so, when I write, the command is sudo tar zxvfjdk-8u31-linux-x64.tar.gz-c/usr/lib/ JVM) Notice the space, there is only one space between the command and the arguments that follow.

Go to the/USR/LIB/JVM directory

After entering the directory, you will start to configure the environment variables. After entering the directory, the commands I use are:

sudo gedit ~/.profile

Then, enter the password, open the file, and at the end of the file, add the path. Then, save, and exit on it. As shown in.

Export java_home=/usr/lib/jvm/jdk1.8.0_31/
Export JRE_HOME=/USR/LIB/JVM/JDK1.8.0_31/JRE
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JAVA _home/lib: $JRE _home/lib: $CLASSPATH
Export path= $JAVA _home/bin: $PATH

If you follow the steps above, you can copy this paragraph, and then change the previous two items to your own JDK version. Then, paste it in.

After saving exit, enter the following code

Then, you can test it. Enter java-version inside the terminal

Input This command is used to reload a configuration, but sometimes I try not to use, restart the system, just can.

So, if it doesn't work, restart it.

Test, the following results will be installed, you can enjoy writing Java programs.

In this process, I have no problem. Have a question, leave a message to discuss. Then, it is the installation of Tomcat.

To install Tomcat:

Download Tomcat First, this is the URL i downloaded

http://tomcat.apache.org/download-80.cgi

I downloaded the version 8.0. The same suffix is tar.gz.

This, I am also Baidu, reference an experience, address is:

Http://jingyan.baidu.com/article/e4d08ffdabb0710fd2f60de9.html

Here are the steps:

Note These commands, do not copy directly inside the terminal, look at their own download version name and folder name, on your own computer. Change the folder name to the one you downloaded.

Unzip Tomcat 8, with the following command (i downloaded the tar.gz format), you have to CD to this file directory below, and then use the following command:

TAR-ZXVF apache-tomcat-8.0.12.tar.gz

Then, copy the extracted files to the/OPT directory

sudo cp-r apache-tomcat-8.0.12/opt

Enter the/opt/apache-tomcat-8.0.12 directory

cd/opt/apache-tomcat-8.0.12

Open a startup script file

sudo gedit./bin/startup.sh

Open the file and write the JDK path to it.

For example, this is mine. What I add to it is:

Java_home=/usr/lib/jvm/jdk1.8.0_31
Jre_home=${java_home}/jre
Path= $JAVA _home/bin: $PATH
Classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
tomcat_home=/opt/apache-tomcat-8.0.17

Do not copy directly, you must press your previous JDK path. Note the name of the folder. According to their own. Detailed, not placed directly at the end of the entire file. The most popular line of my startup.sh file is:

Exec "$PRGDIR"/"$EXECUTABLE" start "[email protected]"

To put it on this line. Before the online did not write, let me also do not know, made a long time. Just because of this problem.

To start Tomcat:

sudo./bin/startup.sh

This way, you can start Tomcat.

Verify that the Tomcat configuration and installation are successful:

In the browser, type: http://localhost:8080/

If it is, it succeeds.

Turn Tomcat off:

sudo./bin/shutdown.sh

Note that closing this file, like the startup.sh file, is the same as when you start Tomcat, and you need to add the JDK path, the same way, and no longer write.

Ubuntu 14.04 Installation Jdk,tomcat

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.