[Software Testing] Install jdk and configure environment variables under Linux system (detailed steps)


Preface

1. Installation environment

Operating system: CentOS 07 64-bit
jdk version: 1.8
Tools: Xshell6, Putty, WinSCP

Note: This article is about remote connection to Linux through the WinSCP tool. It would be more convenient to operate directly on the Linux visual interface. The principle is the same.

2. Installation steps

Step 1: Download the jdk1.8 installation package under Linux environment (it seems that you need to register when downloading the installation package from the oracle official website now, which is a bit troublesome and I don’t have a picture, but you can also download it from non-official websites)

Since my Linux is 64-bit, I downloaded jdk-8u131-linux-x64.tar.gz

Note:
If Linux itself is connected to the Internet, we can also directly download the JDK installation package through the wget command (command: wget + download address), but I have not tried it. I downloaded the installation package directly and uploaded it to the server.

Step 2: Decompress the installation package.
Upload the installation package we downloaded to the server and decompress it.

E1

Unzip command to decompress

cd /root
tar -zxvf jdk-8u131-linux-x64.tar.gz

E2

After decompression is completed, you can see a directory named [jdk1.8.0_131] in the current directory, which contains related files.

E3

We need to move all the data in the decompressed [jdk1.8.0_131] to the folder we need to install. We plan to install jdk in usr/java. We create a new java folder in the usr directory.

cd /usr
mkdir /usr/java

E4

Copy the data in [jdk1.8.0_131] to the java directory

mv /root/jdk1.8.0_131 /usr/java

E5

Move the unzipped files to this directory:

E6

Step 3: Edit the configuration file and modify the environment variables
through commands.

vi /etc/profile

Press i on the keyboard to enter editing mode

export JAVA_HOME=/usr/java/jdk1.8.0_131
export CLASSPATH=${JAVA_HOME}/lib
export PATH=$PATH:${JAVA_HOME}/bin
<strong><img src="https://img2018.cnblogs.com/blog/1425043/201906/1425043-20190612111122973-1727677214.png" alt="" width="713" height="446" class="medium-zoom-image"></strong>

Then, save and exit (press: wq!)

After saving, we still need to make the environment variable configuration information take effect, otherwise we can only restart the computer to take effect.

Run the command source /etc/profile to make the profile file take effect immediately, as shown in the figure

E7

The fourth step is to test whether the installation is successful.
Use the javac command, and the command not found error will not appear.
Use java -version, and the version will be java version "1.8.0_131"
echo $PATH to see if the environment variable configuration you just set is correct. correct

E8

The installation is now complete.

PS Possible error messages:

bash: ./java: cannot execute binary file

The reason for this error may be that a 64-bit jdk is installed on a 32-bit operating system.

Check whether the jdk version and the Linux version have the same number of bits;
check whether the Ubuntu you installed is a 32-bit or 64-bit system;

Use the following command to check the system version number

sudo uname -m

E9

i686    //表示是32位
x86_64  // 表示是64位

When installing jdk, please note that 64-bit operating systems must install 64-bit jdk, and they must correspond one to one, otherwise an error will be reported. Before installing, you must first find out the version number.

The following is the most comprehensive software testing engineer learning knowledge architecture system diagram in 2023 that I compiled.

1. Python programming from entry to proficiency

Please add image description

2. Practical implementation of interface automation projects

Please add image description

3. Web automation project actual combat

Please add image description

4. Practical implementation of App automation project

Please add image description

5. Resumes of first-tier manufacturers

Please add image description

6. Test and develop DevOps system

Please add image description

7. Commonly used automated testing tools

Please add image description

8. JMeter performance test

Please add image description

9. Summary (little surprise at the end)

Every effort is one step closer to success, and unremitting struggle creates a brilliant life. Believe in yourself and move forward courageously. As long as you have a dream, you can create unlimited possibilities!

No matter how difficult it is ahead, you must firmly believe in your abilities and value and move forward courageously; only by working hard can you welcome the dawn of success. As long as you have dreams and work hard, you will eventually achieve brilliance and create your own wonderful life!

Persevere in adversity and pursue your dreams bravely; persevere in difficulties and create a brilliant life. Embrace challenges and surpass yourself. Only by struggling can we win the future. Believe in yourself and don’t stop.

Guess you like

Origin blog.csdn.net/m0_60054525/article/details/132277199