First let's check to see what version of JDK we have installed by running the command
java -version
As you can see Fedora installs the OpenJDK library by default. What we want to do is replace it with the Oracle version instead.
Type the address http://www.oracle.com/technetwork/java/javase/downloads/index.html
into Firefox in the Fedora VM and click on the "JDK" download button
Accept the license agreement and download the Linux version
Select "Save File" then click "OK"
Once the file is downloaded you can find the file at your home directory by typing
cd ./Downloads/
Now we want to create a folder call java in the path /usr/local with this command
sudo mkdir -p /usr/local/java
Since this is going to be our development machine we can just switch to the super user with the command sudo su to speed things up
Now copy the files to the local/java folder with this command
cp -r jdk-10.0.2_linux-x64._bin.tar.gz /usr/local/java
Navigate to the /usr/local/java folder with the command cd /usr/local.java and extract the .tar file with this command
tar xvzf jdk-10.0.2_linux-x64._bin.tar.gz
Open the /etc/profile file with the command nano /etc/profile and add the following line to the end of the file
JAVA_HOME=/usr/local/java/jdk-10.0.2
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
Press Ctrl+O to save the file, then Press Ctrl+X to exit
Type the following commands in the terminal
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk-10.0.2/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk-10.0.2/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk-10.0.2/bin/javaws" 1
Type in the following commands to make Oracle JDK the default JDK
sudo update-alternatives --set java /usr/local/java/jdk-10.0.2/bin/java
sudo update-alternatives --set javac /usr/local/java/jdk-10.0.2/bin/javac
sudo update-alternatives --set javaws /usr/local/java/jdk-10.0.2/bin/javaws
Type the following command to apply the configuration in the /etc/profile file
Reboot Fedora by typing reboot
You have successfully installed the Oracle JDK on Fedora.
Similar Posts:
- Using Fedora As Your Development Desktop
- Fedora: Making VirtualBox Fullscreen by Installing Guest Additions
- Docker : Pull The Latest Fedora Image Into A Ubuntu Server
- Fedora: Install Eclipse IDE
Đặt vé máy bay tại Aivivu, tham khảo
ReplyDeletevé máy bay đi Mỹ tháng nào rẻ nhất
bay từ mỹ về việt nam
é bay từ nhật về việt nam
vé máy bay khứ hồi từ đức về việt nam
giá vé máy bay từ Vancouver về việt nam
Máy bay từ Hàn Quốc về Việt Nam
chi phi ve may bay cho chuyen gia nuoc ngoai