I am trying to install the Java Development Kit (JDK) on Ubuntu Linux distro, but I am unable to install it.
What are the steps to install it on Ubuntu?
Join Stack Overflow to learn, share knowledge, and build your career.
|
I am trying to install the Java Development Kit (JDK) on Ubuntu Linux distro, but I am unable to install it. What are the steps to install it on Ubuntu? |
|||||||||
|
|
Referring to Ask Ubuntu question How to set JAVA_HOME for OpenJDK?, How to install "Open JDK" (Java developement kit) in Ubuntu (Linux)?
|
|||||||||||||||||||||
|
|
|||||||||||||||||||||
|
|
You can install Oracle's JDK 1.7 fairly easily too; as an example this is how to install JDK 1.7.0_13;
As root, do;
As your normal user, add or change these two lines in your ~/.profile to point to the installation;
If it's an update, you may also want to remove the old java installation directory in Log out and in again (or do The downside with Oracle's JDK is that it won't update with the rest of your system like OpenJDK will, so I'd mostly consider it if you're running programs that require it. |
|||||||||||||||||||||
|
|
In case you have already downloaded the ZIP file follow these steps. Run the following command to unzip your file.
After installation is complete, set environment variables as follows. Edit the system path in file
Add the following lines at the end.
Source: http://javaandme.com/ |
|||||||||
|
|
If you want to install the latest JDK 1.8, use the webupd8team PPA. Add the repository in your system:
You can now install Oracle Java 8 using the following command:
This ppa repository also provides a package to set environment variables automatically. Just type :
Hope this will help! |
|||
|
|
|
OpenJDK is OK for the most cases, but Oracle JDK can be required for some bank client applications (my case) - I can't use OpenJDK. I'm surprised that I don't see any answer with default method (repository without external PPAs) in Ubuntu 12.10+ for Oracle's JDK - will try to describe it.
It's officially supported way from debian developers for installing Oracle JDK, and I suppose it's very simple. |
|||||||||||||||||
|
|
Installing Java 8 on Ubuntu First you need to add webupd8team Java PPA repository in your system and install Oracle Java 8 using following set of commands.
Verify Installed Java Version After successfully installing oracle Java using above step verify installed version using following command.
Configuring Java Environment In Webupd8 ppa repository also providing a package to set environment variables, Install this package using following command.
|
|||
|
|
|
Simply run:
|
|||
|
|
|
For Ubuntu 10.04 LTS, the sun-java6 packages have been dropped from the Multiverse section of the Ubuntu archive. It is recommended that you use openjdk-6 instead. If you can not switch from the proprietary Sun JDK/JRE to OpenJDK, you can install sun-java6 packages from the Canonical Partner Repository. You can configure your system to use this repository via command-line:
For Ubuntu 10.10, the sun-java6 packages have been dropped from the Multiverse section of the Ubuntu archive. It is recommended that you use openjdk-6 instead. If you can not switch from the proprietary Sun JDK/JRE to OpenJDK, you can install sun-java6 packages from the Canonical Partner Repository. You can configure your system to use this repository via command-line:
|
||||
|
|
|
Using a PPA You can use WebUpd8 PPA (this will download the required files from Oracle and install JDK 8):
Are PPA's safe to add to my system and what are some “red flags” to watch out for? Also ensure your JAVA_HOME variable has been set to:
Manual install The tar.gz provided by Oracle don't have an actual installation process. You just extract those files to a location you want and add them to your path. So the process is the following: Download a Move the extracted folder to
Create a file
Done! Those paths will only be recognized after you logout or restart, so if you want to use them right away run |
||||
|
|
|
You can use Before installing java type: |
||||
|
|
|
|
||||
|
|
|
I recommend JavaPackage: https://wiki.debian.org/JavaPackage It's very simple, you just need to follow the instructions to create a .deb package from the oracle tar.gz file. |
|||
|
|
|
sun-java6-jdk is a virtual package provided by oracle-java8-installer or oracle-java7-installer or oracle-java7-installer.
will give you sun-java6-jdk. |
|||||
|
|
you can install via apt-get:
also via manually
after do not forget check version
|
|||
|
|
|
If you want to install Oracle JDK, you can use this automated script that does all the work for you. There are detailed instructions how to use it on the author's blog. |
|||
|
|
|
Installing Oracle's Java JDK requires you to accept the Oracle license before the installation begins. This is only required once. If for some reason you need the installation to be automated, you can run the following commands to install without user interaction, useful for an automatic script for example.
|
||||
|
|
|
You can use oraji. It can install/uninstall both JDK or JRE from oracle java (.tar.gz).
|
||||
|
|
|
I had the same problem and none of the comments worked for me. Finally, I noticed that I disabled my updates. When I reactivate it, so sudo apt-get update worked correctly and the issue was solved. (update in system settings> software and updates>updates tab here I ticked two first option of important update and recommended updates). |
|||
|
|
|
Best is to install default java until specific java version is not required. before this execute java -version to check if Java is not already installed. sudo apt-get update That is everything that is needed to install Java. |
|||
|
|
|
try this link in case you Not want to install open_jdk https://github.com/shahriyar1369/JDK_Source_installer_for_ubuntu |
|||
|
|
|
Execute these series of commands (Insert/Update/Install)and you are all set to go.
|
||||
|
|
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?