Install jdk script in linux

Source: Internet
Author: User
Every time you install the linux operating system, you need to download jdk, install jdk, and set environment variables. this time, you have to write a script to complete viewplain #! /Bin/bashchmodu + xjdk-6u29-linux-i586.bininstallPath/usr/javaif [! -D/usr/java]; th...

Every time you install the linux operating system, you need to download jdk, install jdk, and set the environment variables. this is very troublesome. this time, you need to write a script to fix it once.

 

View plain

#! /Bin/bash

 

Chmod u + x jdk-6u29-linux-i586.bin

InstallPath =/usr/java

If [! -D/usr/java];

Then

Mkdir/usr/java

Fi

Jdk-6u29-linux-i586.bin-D/usr/java

Cp-R jdk1.6.0 _ 29 // usr/java/jdk1.6.0 _ 29/

 

Touch environment www.2cto.com

Echo "PATH = \" $ PATH:/usr/java/jdk1.6.0 _ 29/bin \ ""> environment

Echo "JAVA_HOME =/usr/java/jdk1.6.0 _ 29/bin"> environment

Echo "CLASSPATH =.: % JAVA_HOME %/lib/dt. jar: % JAVA_HOME %/lib/tools. jar"> environment

Rm-rf/etc/environment

Cp environment/etc

Source/etc/environment

Update-alternatives -- install/usr/bin/java/usr/java/jdk1.6.0 _ 29/bin/java 300

Update-alternatives -- install/usr/bin/javac/usr/java/jdk1.6.0 _ 29/bin/javac 300

Update-alternatives -- config java

 

From yizhizouxiaqu's column

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.