A bash script that automatically configures the Java development environment under Fedora (for Linux using Bash terminal)

Source: Internet
Author: User
Tags install package files

Javase Package for installation files:

Jdk-8u11-linux-x64.tar.gz

Eclipse File Compression Package:

Eclipse-jee-luna-r-1403767800374.tar.gz

IntelliJ idea free version of the ZIP package:

Ideaic-13.1.4b.tar

Pre-installation preparations:

Create a new directory in the root directory/program, set it to the current user's full rights state

You need to run the script in the current user's directory (you can modify it yourself), install package files to find the use of the regular, please modify it as needed

Script to install Java environment (only for users who run the script and need to log back on for normal use)

install.sh

1#!/bin/Bash2 3 4#===============1. Copy and unzip the folder =================5 6 #复制文件到根目录程序文件夹下7 8 Echo "=========== Start Installation ============"9 Tenjdk_source_file=$ (Echojdk-*.Tar. Gz) One  A #文件包为压缩文件 - Echo "copying $jdk_source_file to directory \/program ..." -  the CP$JDK _source_file/ Program -  - #进入到程序目录 -CD/ Program +  - #解压文件到当前目录 + Echo "start decompression $jdk_source_file ..." A  at Tar-ZXVF $JDK _source_file >Info.txt -  - RM$JDK _source_file - RMInfo.txt -  - Echo "Unzip done." in  -#此时在/a folder appears under program tojdk_dir=$ (EchoJdk*.*.*_*) +  - CD the  *Java_home="java_home=/program/$JDK _dir" $ Panax NotoginsengClasspath='classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar' -  theGlobel_path='path= $JAVA _home/bin: $PATH' +  A Echo "">>./. Bash_profile the Echo "#Set Java Runtime Environment">>./. Bash_profile + Echo "">>./. Bash_profile - Echo$JAVA _home >>.. Bash_profile $ Echo$CLASSPATH >>./. Bash_profile $ Echo$GLOBEL _path >>.. Bash_profile -  - Echo "">>./. Bash_profile the Echo 'export PATH CLASSPATH java_home'>>./. Bash_profile - WuyiSource./. Bash_profile the  - Echo "write to the current user's profile successfully! " Wu Echo "====================================" - Echo "do not exit the current terminal! " About Echo "Enter Java-version to verify if the installation was successful" $ Echo "to make it fully effective for the current user, log off the current user and log back in"

Install Eclipse script (actually the script that unpacked the package)

install_eclipse.sh

1#!/bin/Bash2 3eclipse=$ (Echoeclipse-*.Tar. Gz)4 5 CP$ECLIPSE/ Program6 7CD/ Program8 9 Tar-ZXVF $ECLIPSE >Info. txtTen  One RM$ECLIPSE A RM Info. txt -  - CD the  - Echo "">>./. Bash_profile - Echo "path=/program/eclipse:\ $PATH">>./. Bash_profile - Echo "Export PATH">>./. Bash_profile +  -Source./. Bash_profile +  A Echo "Open the software by executing the Eclipse executable file in the/program/eclipse directory" at Echo "You can also enter Eclipse open software directly under the current terminal" - Echo "to make it fully effective for the current user, log off the current user and log back in"

Install IntelliJ Idea's script (also the operation of unpacking the package, basically the implementation of the Eclipse installation script)

install_idea.sh

1#!/bin/Bash2 3idea=$ (Echoideaic-*.Tar. Gz)4 5 CP$IDEA/ Program6 7CD/ Program8 9 Tar-ZXVF $IDEA >>Info. txtTen  One RM$IDEA A RM Info. txt -  -idea_dir=$ (Echoidea-ic-*) the  - CD -  - Echo "">>./. Bash_profile + Echo  "path=/program/$IDEA _dir/bin:\ $PATH">>./. Bash_profile - Echo "Export PATH">>./. Bash_profile +  ASource./. Bash_profile at  - Echo "please run idea.sh in/program/$IDEA _dir/bin directory to open idea" - Echo "or enter idea.sh directly under the current terminal to start" - Echo "to make it fully effective for the current user, log off the current user and log back in"

In summary is my implementation method, just learned half a month shell script, not very understand, not with what complex syntax, is the most cumbersome code stuffing, with new ideas I will gradually improve.

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.