Linux installation jdk------(jenkins build error: .java:16: error: package javafx.util does not exist)

1. Error reporting

jenkins build error

package javafx.util does not exist

2. The reason for the error

The code finds that the javafx class is used, which only exists in OracleJDK and does not exist in OpenJDK.
The jenkins server is installed with openjdk
insert image description here

3. Uninstall OpenJDK

Not outlined in detail

4. Install OracleJDK offline

1) Download OracleJDK (version: jdk-11.0.8_linux-x64)

https://pan.quark.cn/s/a1d4221104c8

2) Create a jdk directory and enter

mkdir -p /usr/local/jdk
cd /usr/local/jdk

3) Upload the downloaded jdk package to this directory through the rz command or xftp, and decompress it

tar -zxvf jdk-11.0.8_linux-x64_bin.tar.gz

4) Configure environment variables

vim /etc/profile

5) Click the keyboard i to edit, and paste the following content to the end;

export JAVA_HOME=/usr/local/jdk/jdk-11.0.8
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

Note that /usr/local/jdk/jdk-11.0.8 is your own jdk directory
insert image description here

6) Save changes

Esc
:wq 

7) Reload the configuration file, command:

source /etc/profile 

5. Check whether the JDK is installed successfully

java -version

insert image description here

6. Modify the jdk configuration of jenkins

Manage Jenkins -> Global Tool Configuration -> JDK
insert image description here

Guess you like

Origin blog.csdn.net/weixin_43466526/article/details/129063621