Last active
January 27, 2024 19:11
-
-
Save starlinq/9ee5209ceb32b7e05817e714fe530be3 to your computer and use it in GitHub Desktop.
Revisions
-
starlinq revised this gist
Jul 23, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -127,7 +127,7 @@ Paths can be different based on version and update, here the version is 1.8 and # PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/jdk1.8.0_181/bin:/usr/lib/jvm/jdk1.8.0_181/db/bin:/usr/lib/jvm/jdk1.8.0_181/jre/bin" J2SDKDIR="/usr/lib/jvm/jdk1.8.0_181" J2REDIR="/usr/lib/jvm/jdk1.8.0_181/jre*" JAVA_HOME="/usr/lib/jvm/jdk1.8.0_181" DERBY_HOME="/usr/lib/jvm/jdk1.8.0_181/db" ``` -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -104,7 +104,7 @@ sudo update-alternatives --config javac sudo update-alternatives --config javaws ``` 8. Set environment variables Edit the environment file: @@ -117,7 +117,6 @@ My current environment file contains: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" ``` Update the existing PATH variable by adding the below bin folders, separated with a colon :. `/usr/lib/jvm/jdk1.8.0_181/bin:/usr/lib/jvm/jdk1.8.0_181/db/bin:/usr/lib/jvm/jdk1.8.0_181/jre/bin` -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -60,6 +60,8 @@ sudo mv ./jdk1.8.0_181 /usr/lib/jvm ``` The complete folder “jdk1.8.0_version” will be moved to `/usr/lib/jvm`. Delete the .tar.gz file if you want to save disk space. 6. Inform Ubuntu to use this JDK ```console -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 1 addition and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -131,13 +131,8 @@ JAVA_HOME="/usr/lib/jvm/jdk1.8.0_181" DERBY_HOME="/usr/lib/jvm/jdk1.8.0_181/db" ``` Save changes and close the file. Log out and log in again. You can now test whether the environment variable has been set by executing the following command: ```console -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 6 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,21 @@ # How to install Java JDK8 in Ubuntu 16.04 Let's consider a JDK8 installation using 2 different versions: default and Oracle. The default version is easiest because it is packaged with Ubuntu. There is default Java installation called the JDK (Java Development Kit). The JDK is usually only needed if you are going to to do some software developmwent using Java or if some software requires it. The JDK does contain the JRE. ## Installing the default JDK This will install OpenJDK 8, the latest and recommended version. First, update the package index: ```console sudo apt update ``` You can install the JDK with the following command: ```console -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 23 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,27 @@ # How to install Java JDK8 in Ubuntu 16.04 ## Installing the default JDK There is default Java installation called the JDK (Java Development Kit). The JDK is usually only needed if you are going to to do some software developmwent using Java or if some software requires it. The easiest option for installing Java JDK8 is using the version packaged with Ubuntu. This will install OpenJDK 8, the latest and recommended version. First, update the package index: ```console sudo apt update ``` The JDK does contain the JRE. You can install the JDK with the following command: ```console sudo apt-get install default-jdk ``` ## Installing the Oracle JDK 1. Download the latest JDK file -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -96,7 +96,7 @@ Update the existing PATH variable by adding the below bin folders, separated wit `/usr/lib/jvm/jdk1.8.0_181/bin:/usr/lib/jvm/jdk1.8.0_181/db/bin:/usr/lib/jvm/jdk1.8.0_181/jre/bin` Paths can be different based on version and update, here the version is 1.8 and the update is 181. Add the below variables at the end of environment file, making changes for your specific version and update. I commented out original line. ```console # PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" @@ -114,6 +114,11 @@ Reload it: ```console source /etc/environment ``` You can now test whether the environment variable has been set by executing the following command: ```console echo $JAVA_HOME ``` Verify the Java version -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -109,7 +109,11 @@ DERBY_HOME="/usr/lib/jvm/jdk1.8.0_181/db" Save changes and close the file. Reload it: ```console source /etc/environment ``` Verify the Java version -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 11 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -94,15 +94,19 @@ PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/u Update the existing PATH variable by adding the below bin folders, separated with a colon :. `/usr/lib/jvm/jdk1.8.0_181/bin:/usr/lib/jvm/jdk1.8.0_181/db/bin:/usr/lib/jvm/jdk1.8.0_181/jre/bin` HOME directory paths can be different based on version and update, here the version is 1.8 and the update is 181. Add the below variables at the end of environment file, making changes for your specific version and update. ```console # PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/jdk1.8.0_181/bin:/usr/lib/jvm/jdk1.8.0_181/db/bin:/usr/lib/jvm/jdk1.8.0_181/jre/bin" J2SDKDIR="/usr/lib/jvm/jdk1.8.0_181" J2REDIR="/usr/lib/jvm/jdk1.8.0_181/jre* JAVA_HOME="/usr/lib/jvm/jdk1.8.0_181" DERBY_HOME="/usr/lib/jvm/jdk1.8.0_181/db" ``` Save changes and close the file. -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 8 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -83,19 +83,20 @@ sudo update-alternatives --config javaws Edit the environment file: ```console sudo gedit /etc/environment ``` My current environment file contains: ```console PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" ``` Update the existing PATH variable by adding the below bin folders, separated with a colon :. /usr/lib/jvm/jdk1.8.0_151/bin:/usr/lib/jvm/jdk1.8.0_151/db/bin:/usr/lib/jvm/jdk1.8.0_151/jre/bin HOME directory paths can be different based on version and update,here the version is 1.8 and the update is 151. Add the below variables at the end of environment file, making changes for your specific version and update. PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/jdk1.8.0_151/bin:/usr/lib/jvm/jdk1.8.0_151/db/bin:/usr/lib/jvm/jdk1.8.0_151/jre/bin" J2SDKDIR="/usr/lib/jvm/jdk1.8.0_151" -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -80,9 +80,12 @@ sudo update-alternatives --config javaws 7. Set environment variables Edit the environment file: ```console gedit /etc/environment ``` Update the existing PATH variable by adding the below bin folders, separated with a colon :. /usr/lib/jvm/jdk1.8.0_151/bin:/usr/lib/jvm/jdk1.8.0_151/db/bin:/usr/lib/jvm/jdk1.8.0_151/jre/bin -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 13 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -69,6 +69,8 @@ Press <enter> to keep the current choice[*], or type selection number: ``` In this case, I select the last number and press enter to exit this utility i.e. in this example it is the number 2. If you are going to use `javac` and `javaws`, repeat the above for: ```console @@ -99,27 +101,22 @@ JAVA_HOME="/usr/lib/jvm/jdk1.8.0_151" DERBY_HOME="/usr/lib/jvm/jdk1.8.0_151/db" Save changes and close the file. Verify the Java version ```console java -version ``` The output should resemble the following: ```console java version "1.8.0_181" Java(TM) SE Runtime Environment (build 1.8.0_181-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode) ``` You should be able to see your installed java version which means you have successfully installed the Oracle JDK. -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -69,6 +69,13 @@ Press <enter> to keep the current choice[*], or type selection number: ``` If you are going to use `javac` and `javaws`, repeat the above for: ```console sudo update-alternatives --config javac sudo update-alternatives --config javaws ``` 7. Set environment variables Edit the environment file. -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 21 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -48,6 +48,27 @@ This will assign Oracle JDK a priority of 1, which means that installing other J The executables `java, javac, javaws` are probably the most frequently used. 7. If you have multiple java installations you need to configure it by ```console sudo update-alternatives --config java ``` in my case (before this installation, I have installed OpenJDK8), it gives ```console There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 auto mode 1 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode 2 /usr/lib/jvm/jdk1.8.0_181/bin/java 1 manual mode Press <enter> to keep the current choice[*], or type selection number: ``` 7. Set environment variables Edit the environment file. -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,7 +46,7 @@ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1 This will assign Oracle JDK a priority of 1, which means that installing other JDKs may replace it as the default. Use a higher priority if you want Oracle JDK to remain the default. The executables `java, javac, javaws` are probably the most frequently used. 7. Set environment variables -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 14 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ 1. Download the latest JDK file A current link is http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html, if there is no such page you can find it from general download page <http://www.oracle.com/technetwork/java/javase/downloads/index.html> The latest version is Java SE Development Kit 8u181. @@ -36,7 +36,19 @@ sudo mv ./jdk1.8.0_181 /usr/lib/jvm ``` The complete folder “jdk1.8.0_version” will be moved to `/usr/lib/jvm`. 6. Inform Ubuntu to use this JDK ```console sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_181/bin/java" 1 sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_181/bin/javac" 1 sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.8.0_181/bin/javaws" 1 ``` This will assign Oracle JDK a priority of 1, which means that installing other JDKs may replace it as the default. Use a higher priority if you want Oracle JDK to remain the default. The exetables `java, javac, javaws` are probably the most frequently used. 7. Set environment variables Edit the environment file. -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,8 +36,8 @@ sudo mv ./jdk1.8.0_181 /usr/lib/jvm ``` The complete folder “jdk1.8.0_version” will be moved to `/usr/lib/jvm`. 6. Set environment variables Edit the environment file. # vi /etc/environment -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ 1. Download the latest JDK file A current link is http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html, if there is no such page you can go to general download page <http://www.oracle.com/technetwork/java/javase/downloads/index.html> The latest version is Java SE Development Kit 8u181. -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ A current link is http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html The latest version is Java SE Development Kit 8u181. The archive file for Linux x64 is `jdk-8u181-linux-x64.tar.gz` @@ -34,7 +34,7 @@ You will find a folder with the name as `jdk1.8.0_181`. ```console sudo mv ./jdk1.8.0_181 /usr/lib/jvm ``` The complete folder “jdk1.8.0_version” will be moved to `/usr/lib/jvm`. Step 3: Set environment variables -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ A current link is http://www.oracle.com/technetwork/java/javase/downloads/jdk8-d The latest version is Java SE Development Kit 8u181 The archive file for Linux x64 is `jdk-8u181-linux-x64.tar.gz` Before the file can be downloaded, you must accept the license agreement. The archive binary can be installed by anyone (not only root users), in any location that you can write to. However, only the root user can install the JDK into the system location. -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,7 +34,7 @@ You will find a folder with the name as `jdk1.8.0_181`. ```console sudo mv ./jdk1.8.0_181 /usr/lib/jvm ``` The complete folder “jdk_1.8_version” will be moved to `/usr/lib/jvm`. Step 3: Set environment variables -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 2 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,18 +32,11 @@ You will find a folder with the name as `jdk1.8.0_181`. 5. Let's move the directory to default system directory ```console sudo mv ./jdk1.8.0_181 /usr/lib/jvm ``` The complete folder “jdk_1.8_version” will be moved to /usr/lib/jvm. Step 3: Set environment variables Edit the environment file. -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,9 +25,15 @@ $ cd ~/Downloads $ tar zxvf jdk-8u181-linux-x64.tar.gz ``` The Java Development Kit files are installed in a directory called jdk1.8.0_version in the current directory. You will find a folder with the name as `jdk1.8.0_181`. 5. Let's move the directory to default system directory ```console sudo mv /jdk1.8.0_181 /usr/lib/jvm ``` Create a jvm folder in /usr/lib/ which is the default location for Java. -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 8 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,8 +19,15 @@ If you download it from web browser, in typical configuration the file will be s ```console $ cd ~/Downloads ``` 4. Unpack the tarball ```console $ tar zxvf jdk-8u181-linux-x64.tar.gz ``` You will find a folder with the name similar to “jdk_1.8u181”. Create a jvm folder in /usr/lib/ which is the default location for Java. -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 14 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,26 @@ 1. Download the latest JDK file A current link is http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html The latest version is Java SE Development Kit 8u181 The archive file for Linux x64 is jdk-8u181-linux-x64.tar.gz Before the file can be downloaded, you must accept the license agreement. The archive binary can be installed by anyone (not only root users), in any location that you can write to. However, only the root user can install the JDK into the system location. If you download it from web browser, in typical configuration the file will be saved to `~/Downloads` directory 2. Open a terminal using Ctrl+Alt+T key combination 3. Change a current directory to `~/Downloads` ```console $ cd ~/Downloads ``` Extract JDK to Java's default location Create a jvm folder in /usr/lib/ which is the default location for Java. -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ The latest version is Java SE Development Kit 8u181 The archive file is jdk-8u181-linux-x64.tar.gz If you download it from web browser, in typical configuration the file will be saved to `~/Downloads` directory 2. Extract JDK to Java's default location -
starlinq revised this gist
Jul 18, 2018 . 1 changed file with 66 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,69 @@ 1. Download the latest JDK A current link is http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html The latest version is Java SE Development Kit 8u181 The archive file is jdk-8u181-linux-x64.tar.gz If you download it from web browser, in typical configuration the file will be saved to ~/Downloads directory 2. Extract JDK to Java's default location Create a jvm folder in /usr/lib/ which is the default location for Java. # sudo mkdir /usr/lib/jvm Go to the created /usr/lib/jvm folder. # cd /usr/lib/jvm Extract the downloaded JDK. # sudo tar -xvzf ~/Downloads/jdk-8u151-linux-x64.tar.gz Step 3: Set environment variables Edit the environment file. # vi /etc/environment Update the existing PATH variable by adding the below bin folders, separated with a colon :. /usr/lib/jvm/jdk1.8.0_151/bin:/usr/lib/jvm/jdk1.8.0_151/db/bin:/usr/lib/jvm/jdk1.8.0_151/jre/bin HOME directory paths can be different based on version and update,here the version is 1.8 and the update is 151. Add the below variables at the end of environment file, making changes for your specific version and update. J2SDKDIR="/usr/lib/jvm/jdk1.8.0_151" J2REDIR="/usr/lib/jvm/jdk1.8.0_151/jre" JAVA_HOME="/usr/lib/jvm/jdk1.8.0_151" DERBY_HOME="/usr/lib/jvm/jdk1.8.0_151/db" The environment file should now be similar to this text: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/jdk1.8.0_151/bin:/usr/lib/jvm/jdk1.8.0_151/db/bin:/usr/lib/jvm/jdk1.8.0_151/jre/bin" J2SDKDIR="/usr/lib/jvm/jdk1.8.0_151" J2REDIR="/usr/lib/jvm/jdk1.8.0_151/jre* JAVA_HOME="/usr/lib/jvm/jdk1.8.0_151" DERBY_HOME="/usr/lib/jvm/jdk1.8.0_151/db" Save changes and close the file. Step 4: Inform Ubuntu about the installed location Use update-alternatives to inform Ubuntu about the installed java paths. # sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_151/bin/java" 0 # sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_151/bin/javac" 0 # sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_151/bin/java # sudo update-alternatives --set javac /usr/lib/jvm/jdk1.8.0_151/bin/javac Step 5: Setup verification Give the location of java and javac as you provided. # update-alternatives --list java # update-alternatives --list javac Restart the computer or open a new terminal. Step 6: Verify the Java version # java -version The output should resemble the following: java version "1.8.0_151" Java(TM) SE Runtime Environment (build 1.8.0_151-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode) You should be able to see your installed java version which means you have successfully installed the Oracle JDK. -
starlinq created this gist
Jul 18, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ test