Install JDK in linux and linuxjdk

Source: Internet
Author: User

Install JDK in linux and linuxjdk

1. Put the one-click installation script install_JDK.sh and the downloaded jdk1.7 in the same directory and upload it to a directory on the linux server.

Note: The script is used to facilitate one-click installation with other services.

 

 

2. Add the execution permission to install_JDK.sh.

# Chmod + x install_JDK.sh

 

3. Execute the one-click installation script

#./Install_JDK.sh

 

4. Verify the installation

# Java-version

 

5. One-click installation script content

#! /Bin/sh

# Retrieving the current path
Mypath = $ (cd $ (dirname $0)/; pwd)

Function main ()
{
# Install jdk
Install_JDK
Sleep 1
Echo "jdk installation is complete"
}

Function Install_JDK ()
{
Jdk_path =/usr/jdk64/
Profile =/etc/profile
Java_home = "export JAVA_HOME =/usr/jdk64/jdk1.7.0 _ 67"
Classpath = "export CLASSPATH =.: \ $ JAVA_HOME/jre/lib/rt. jar: \ $ JAVA_HOME/lib/dt. jar: \ $ JAVA_HOME/lib/tools. jar"
Path = "export PATH =.: \ $ JAVA_HOME/bin: \ $ PATH"

Jdk_exists_path = $ jdk_path/jdk1.7.0 _ 67/
If [-d "$ jdk_exists_path"]; then
Return 1
Fi

If [! -D/usr/jdk64]; then
Mkdir/usr/jdk64
Fi

Tar zxvf $ {mypath}/jdk-7u67-linux-x64.tar.gz-C $ {jdk_path}

Echo $ java_home> $ profile
Echo $ classpath> $ profile
Echo $ path> $ profile
Source/etc/profile
./Etc/profile
Sleep 1

# Printf "check java version global. \ n"
Java-version
}

Main

 

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.