I downloaded and installed the JDK+Netbeans bundle from the Oracle website, but when I type
java -version at the terminal, I get this output:
$ java -version The program 'java' can be found in the following packages: * default-jre * gcj-4.8-jre-headless * openjdk-7-jre-headless * gcj-4.6-jre-headless * openjdk-6-jre-headless Try: sudo apt-get install <selected package>
Firstly, what does this mean? Are there multiple versions of java installed on my system?
Secondly, there is a JDK folder that got created after I installed Netbeans+JDK. These are the contents of the folder:
$ pwd /usr/local/jdk1.8.0_65 $ ls bin javafx-src.zip man THIRDPARTYLICENSEREADME-JAVAFX.txt COPYRIGHT jre README.html THIRDPARTYLICENSEREADME.txt db lib release include LICENSE src.zip
Thirdly, Android Studio isn't able to find
JDK_HOME even though I gave
export JDK_HOME=/usr/local/jdk1.8.0_65 in
bashrc. What could be done?
I'm considering deleting the
jdk1.8.0_65 folder and using
sudo apt-get install default-jre and
sudo apt-get install default-jdk, but am apprehensive if deleting the jdk folder would mess up something, or whether the
apt-get commands would download the latest version of Java.
Tried adding the
bin folder to
PATH, but although the java version is being shown properly, android studio isn't able to find the JDK.
$ echo $PATH /usr/local/jdk1.8.0_65/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games $ java -version java version "1.8.0_65" Java(TM) SE Runtime Environment (build 1.8.0_65-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode) $ android [sudo] password for nav: ERROR: Cannot start Android Studio No JDK found. Please validate either STUDIO_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation. $ echo $JAVA_HOME /usr/local/jdk1.8.0_65/bin $ echo $JDK_HOME /usr/local/jdk1.8.0_65 $