Install and deploy Linux and JDK in Windows, and use linuxjdk

Source: Internet
Author: User

Install and deploy Linux and JDK in Windows, and use linuxjdk

Preface

My laptop is faulty, so this week the system includes all the hard disks and all the original Linux virtual machines are gone, so I have shared this article with you.

Because of the advantages of the Linux environment (open-source, low-cost, secure, and powerful network functions), some small websites are deployed in Windows for convenience, basically all website servers use the Linux environment (larger Internet companies use the Linux system as servers, such as Alibaba and mogujie.com ).

As a Java programmer, if the server your company uses is not a Linux system, or your personal computer is installed on a Windows system instead of a Linux system, so how should we learn how to use Java and various distributed components in a Linux environment? The answer isInstall the virtual machine + Linux System in Windows and deploy the JDK Environment.

OK. Let's take a look at how to install a virtual machine + a Linux system and deploy the JDK environment in a Windows environment, later I will write some articles on MemCache, Zookeeper, Hadoop, and HSDIS (used to view the bottom-layer assembly code corresponding to bytecode), all of which are based on the Linux environment.

 

Install Virtual Machine + Linux System

The first step is to install the virtual machine + Linux System in a Windows environment. Generally, there are three steps:

1. Install VMWare

Since we are using a Windows system, to run a Linux system, there must be a container running on the Linux system-virtual machine. Common virtual machines include VMWare and VisualBox. The virtual machine used here is VMWare. This is a powerful Virtual Machine software. It is very easy to download and install VMWare:

Baidu searches for VMWare and clicks "normal download". After downloading, you can install it directly. There is nothing special to pay attention to. You can proceed step by step. Of course, as a commercial virtual machine, VMWare requires a serial number for normal use. Here is an available one:YG7XR-4GYEJ-4894Y-VFMNZ-YA296.

2. Download Ubuntu15

There are a lot of options available for Linux operating systems, but since we use Linux for the purpose of learning, we choose Ubuntu, which is a Linux System Based on desktop applications, for personal use, this should be the most common Linux operating system. Of course, for enterprises and applications, servers generally use virtual machines such as Debian series, RedHat series, and BSD series instead of Ubuntu. OK. Back to the question. We downloaded Ubuntu with the latest version, that is Ubuntu 15, which is http://www.ubuntu.com/download/shorttopic. This is the final example:

Select Ubuntu15.10. The current PCs are usually 64-bit. Therefore, select 64-bit. A page is displayed after you click it, the user makes some donations to the Community to support Ubuntu development. If you don't want to donate, it's okay to find the final:

Click the area indicated by the arrow to download an iso file (CD image) with 1.1 GB.

3. Install Ubuntu in VMWare

VMWare has been installed, Ubuntu has been downloaded, and Ubuntu has been installed in VMWare. First, enable VMWare:

Click create new virtual machine, and then:

Select a typical mode and then:

Select the correct path, that is, the path of the disc image you just downloaded Ubuntu15, and click Next. Enter some personal information and passwords. After the password is entered, click Next. VMWare will start to install Ubuntu15. At this time, you have to wait. It will take 20 or 30 minutes, after the installation, enter the password as follows:

As mentioned above, Ubuntu is a Linux system that supports desktop operations. Therefore, if you do not want to use commands in Ubuntu, click the mouse. Of course, this will lose the significance of using Ubuntu. To use commands in Ubuntu, click the box in the upper left corner and enter Terminal:

Click the first one, which is indicated by the Red Arrow:

In this way, you can use various Linux commands.

 

Deploy JDK

After Ubuntu is installed, deploy the JDK environment (JDK 1.7 is used here). to install the JDK environment, take the following steps:

1. Download The JDK1.7 installation package for Linux

First, use the mkdir command in the root directory to create a user directory, and create a jdk directory in the user directory to store the downloaded jdk file, and then useWget-O jdk1.7.tar.gz http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz? AuthParam = 1454252312_ab0b4247373ff20da5741c2b3014eb7dCommand to download the JDK for Linux:

The parameter after the wget command-O is used to specify the name of the file to be saved after the download is completed.

Some people may ask where it comes from. Go to the JDK official website:

Click the area pointed by the Arrow:

Because the external Windows and internal Linux systems are two systems, it is useless to copy the address in a Windows environment in a Linux environment, the address is not long.

2. Unzip the installation package

OK. After the download is completed, decompress the package and useTar-zxvf jdk1.7.tar.gz:

Decompress the package as follows:

The name of the folder outside is a little long. We can name it a little simpler.Mv jdk1.7.0 _ 79 java:

3. Add Environment Variables

After the file name is changed, we need to set the environment variables like installing JDK in Windows. In Linux, the environment variable file is a hidden file, all the hidden files in Linux are. first, open the environment variable configuration file and useVi ~ /. BashrcOpen the file:

UseShift + gDrag the cursor to the last line and append the following four statements to the end of the file:

After writing it, save it (Press:, and then wq). users who are new to Linux will find it difficult to use vi to edit text, baidu has a lot of habits in vi usage and can adapt to it. vi is still one of the commands that must be mastered in Linux.

4. Set Environment Variables

It's easy to set environment variables. Use source ~ /. Bashrc:

5. verify it.

Finally, verify that JDK1.7 is correctly deployed.Java-versionIf the following results are displayed, the JDK1.7 deployment is successful:

Of course, if you want to write code to verify the correctness of JDK deployment, please refer to an unpublished article code below to verify that JDK deployment is correct.

 

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.