Configure the java environment using yum in linux
1. Find a list of java related items
[root@localhost ~] $yum-y list java*
two。 Installation related
Yum install java-1.6.0-openjdk*
Be sure to mount / dev/cdrom to / mnt/cdrom (here I have configured the yum source of my disk here in / etc/yum.repos.d/cd.repo, so I have to mount the CD, of course)
Click on the link here, and note that the image file must be used correctly! I used it incorrectly so that I couldn't install yum all the time.
After mounting, there will be the following files under / mnt/cdrom!
3. Confirm that the installation is successful
[root@localhost ~] $java-version
4. Modify the / etc/profile file, note that I am debugging and playing by myself, once modified, all users here have the permission to compile java!
5. Load this configuration file using source / etc/profile!
6. Write a program at will
Javac Test.java
Java Test
The output indicates that the environment configuration is complete!