Linux installation JDK

Source: Internet
Author: User

Directory

1 Downloads

2 Installation

2.1 Mounting USB drive

2.2 executing the installation command

3 Configuration

4 Annex I: The difference between RPM and tar.gz and the installation and uninstallation

====================================================================

1 Downloads

Official website:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Find the appropriate version, click to download, this example is downloaded:jdk-7u71-linux-x64.rpm


2 Installation

2.1 Mounting USB drive

USB mobile device is usually recognized as SDA1, if it is not known to be recognized as that one, you can use the command: Fdisk-l query, you can determine according to the details of the description of which is your U disk


You can see that/dev/sdb1 is my USB stick.

1. Mount the USB stick to the/mnt/usb directory, if the directory does not exist, then use the command: MKDIR/MNT/USB Create, Mount command: MOUNT/DEV/SDB1/MNT/USB


Mount the USB drive successfully!

2. Uninstalling the USB flash drive

Command: Umount/mnt/usb or/DEV/SDB1, two can be, you can try.


Uninstall USB drive successfully!

2.2 executing the installation command

1. Locate the JDK you want to install on the USB drive;


2. Follow the description of annex I and execute the installation command;

When performing the installation, if the system does not already have the RPM (RedHat packge Manager) Package Manager installed, you will be prompted: The project does not currently have RPM installed. You can install by entering: Apt-getinstall rpm

Follow the instructions to install

Since the virtual machine is not configured to connect to the network, be continued ... Solve

Switch to tar.gz mode for installation


Execute tar.gz Compression Package installation command: Tar zxvf/mnt/usb/software/linux/jdk-7u71-linux-x64.tar.gz

After extracting, move to/java folder, Java does not exist, then create: Mkdir/java, do not need to delete: Rm–rf/java.

Note:-R is recursive down, regardless of how many levels of directory, and delete;-F is directly forcibly deleted, without any hint of meaning;

3 Configuration

1. Set Environment variables:

Open/etc/profile with VI

Note: This document is all used by root user, so it does not require a similar format for sudo commands

Increase on the last side of the file:

Exportjava_home=/java/jdk1.7.0_71

Export classpath=.: $CLASSPATH: $JAVA _home/lib/tools.jar

Export path= $PATH: $JAVA _home/bin

2. Make the environment variable effective:

Source/etc/profile


3. Set to make the JDK available to all users:


After switching to another user, it is discovered that the JDK is not installed because the user does not have permissions.

Configure user-generic JDK--

Command: vi/etc/profile.d/java.sh

Enter the following in the new java.sh:

Java_home=/java/jdk1.7.0_71

Classpath=.: $CLASSPATH: $JAVA _home/lib/tools.jar

Path= $PATH: $JAVA _home/bin

Exportjava_home CLASSPATH PATH

Save the exit and give java.sh permission:

chmod 755/etc/profile.d/java.sh

After the configuration is complete, execute the following command to make the environment variables work.

Source/etc/profile

Note: When each user logs on, the command is executed to make the changed environment variable work. Restarting the operating system is ineffective and must be performed by the command side.


4 Annex I: The difference between RPM and tar.gz and the installation and uninstallation

Binary distribution of Linux software refers to the release form of a package that has been compiled in advance in binary form, with the advantage that installation is easy to use, the disadvantage is lack of flexibility, and if the package is compiled for a specific hardware/operating system platform, it cannot be executed correctly in another platform or environment.

1, *.rpm form of binary package

Installation: Rpm-ivh *.rpm

Uninstall: Rpm-epackgename

Description: RPM (RedHat packge Manager) is a software package manager for RedHat, which makes it easy to install, upgrade, uninstall, verify, query, and so on in RPM-form packages, with simple installation It is also possible to remove the files that are installed in multiple directories when uninstalling, so it is recommended that beginners use the RPM-style software package whenever possible. RPM parameters in the-I is installed,-V is the checksum,-H is a hash to display the installation progress, *.RPM is the package file name (here *.rpm refers to *). src.rpm other than RPM); The parameter-E is the removal of the package, Packgename is the package name, which differs from the file name of the package, which is often the string that precedes the version number in the file name, such as apache-3.1.12-i386.rpm and apache-devel-3 .1.12-i386.rpm is the package file name, and their package names are Apache and Apache-devel, respectively. For more RPM parameters, refer to the man rpm page:

2, *.tar.gz/*.tgz, *.bz2 form of binary package

Installation: Tar zxvf*.tar.gz or tar yxvf *.bz2

Uninstall: Delete manually

Note: Binary packages in *.tar.gz/*.bz2 form are packaged with the TAR tool, compressed with GZIP/BZIP2, and unpacked directly when installed. For only a single directory after decompression software, uninstall with the command "RM-RF software directory Name"; If the files are scattered in multiple directories, you must one by one manually delete (slightly troublesome), you want to know what files are installed to the system when extracting, you can use the command "tar ztvf *.tar.gz"/"tar YTVF *.bz2 "Get the list. The parameter z of TAR is called gzip decompression, X is unpacked, V is checksum, F is the display result, Y is called bzip2 decompression, and T is the list of files listing packages. For more parameters Please refer to man tar.

If you prefer the operation of the graphical interface, you can use KDE's Ark compression file management tool under X-window.

============================================

The distribution of the source code of the Linux software refers to the release form of all the program sources of the software, which requires the user to compile the executable binary code and install it, the advantage is that the configuration is flexible, can remove or retain certain functions/modules, adapt to a variety of hardware/operating system platform and compiling environment, the disadvantage is difficult , generally not suitable for beginners to use.

1, *.src.rpm form of source code package

Installation: rpm-rebuild*.src.rpm

Cd/usr/src/dist/rpms

RPM-IVH *.rpm

Uninstall: Rpm-epackgename

Description: The rpm--rebuild*.src.rpm command compiles the source code and generates a binary RPM package under/usr/src/dist/rpms, and then installs the binary package. Packgename as mentioned earlier.

2, *.tar.gz/*.tgz, *.bz2 form of source code package

Installation: Tar zxvf*.tar.gz or tar yxvf *.bz2 first unzip

Then go to the extracted directory:

./configure Configuration

Make compilation

Make install Installation

Uninstall: Makeuninstall or manually delete

Note: It is recommended to read the documentation before extracting, to understand what the installation needs, if necessary, you need to change the compilation configuration. The source code of some packages can be uninstalled with the Make install command after compilation and installation, and if this feature is not provided, the uninstallation of the software must be manually removed. Since the software may be distributed across multiple directories in the system, it is often difficult to remove it cleanly, you should configure it before compiling, specifying that the software will be installed to the target path:./configure--prefix= directory name, so you can use "RM-RF Software directory Name" command to perform a clean and thorough uninstallation. Compared with other installation methods, it is most difficult for users to compile and install themselves, it is suitable for people who have some experience in Linux, and it is generally not recommended for beginners to use.

Annex I from:

http://www.pttc.yn.cninfo.net/dtsy/nettech/linux/2001927104108.htm

Linux installation JDK

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.