-
Notifications
You must be signed in to change notification settings - Fork 1
/
java8-install
executable file
·36 lines (31 loc) · 1.49 KB
/
java8-install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
cd /opt
# sudo wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"
# sudo tar xzf jdk-8u141-linux-x64.tar.gz
# sudo rm -rf jdk-8u141-linux-x64.tar.gz
cd /opt/jdk1.8.0_141/
sudo alternatives --install /usr/bin/java java /opt/jdk1.8.0_141/bin/java 2
sudo alternatives --config java
sudo alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_141/bin/jar 2
sudo alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_141/bin/javac 2
sudo alternatives --set jar /opt/jdk1.8.0_141/bin/jar
sudo alternatives --set javac /opt/jdk1.8.0_141/bin/javac
sudo tee /etc/profile.d/java.sh <<-'EOF'
export JAVA_HOME=/opt/jdk1.8.0_141
export JRE_HOME=/opt/jdk1.8.0_141/jre
export PATH=$PATH:/opt/jdk1.8.0_141/bin:/opt/jdk1.8.0_141/jre/bin
EOF
# mkdir /tmp/jce_policy
# cd /tmp/jce_policy
# wget \
# --no-cookies \
# --no-check-certificate \
# --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \
# -O jce_policy-8.zip \
# http://download.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip
# unzip jce_policy-8.zip
# sudo cp UnlimitedJCEPolicyJDK8/local_policy.jar /opt/jdk1.8.0_141/jre/lib/security
# sudo cp UnlimitedJCEPolicyJDK8/US_export_policy.jar /opt/jdk1.8.0_141/jre/lib/security
# rm -rf UnlimitedJCEPolicyJDK8
# cd ..
# rm -rf /tmp/jce_policy