Problems installing Java on Ubuntu

Trying to install Java (JDK 6) on my new Ubuntu system and getting some bizarro errors. This is my first time ever using any flavor of Linux, and so I'm sure this is a user problem (permissions or others).

I downloaded the BIN file directly from the Oracle site (Java SE 6u23 for 64-bit Linux). This was loaded by default at / home / myUserName / Downloads.

From there, I moved the file to / opt / java, which was the directory I created, because (as a Linux newbie) it made sense to be the directory where Java should go.

Then I executed the following 2 commands, for each instruction I found online to run BIN:

chmod +x jdk-6u23-linux-x64.bin
sudo ./jdk-6u23-linux-x64.bin

Now, in my / opt / java directory, I see both the BIN file and the jdk1.6.0_23 directory , which does not seem to be corrupted after checking.

But , when I open a new terminal and start a java version, I get:

The java program can be found in the following packages:
 - gcj-4.4-jre-headless
 - gcj-4.5-jre-headless
 - openjdk-6-jre-headless
Try: sudo apt-get install

What's going on here?!?

(1) Did I try to make / opt / java my Java directory incorrectly?
(2) Did I run the wrong commands?
(3) Is Java 1.6.0_23 even installed on my machine?
(4) What are all these gcj-xxx-headless goals?!?!

Thanks for any input!

+5
7

/opt/java Java?

. Java JDK /opt/jdk1.6.0_23 . bin , . java , /bin.

JDK , /opt chown.

?

. JDK, . , , , , aptitude install sun-java6-jdk .

bin imho , Java . , , Linux.

java , PATH JAVA_HOME. , Ubuntu /etc/environment /etc/profile - .

Java 1.6.0_23 ?

. . .

gcj-xxx-headless?!?

GCJ - Gnu Java. , Java Development Kit Java.

+7

bin, :

sudo apt-get install sun-java6-jdk

- , , apt-get, PATH ..

+6

JDK . /opt/java /opt/jdk , , .

PATH, /opt/java/bin dir symlink (ln -s)/opt/java/bin/java , /usr/bin/

+1

JDK, Sun/Oracle, JDK. "" JDK - . JDK BIN, . java -version, FOSS Java, Java, /opt. - , JDK. Oracle Java, /usr/bin/java /opt/jdk1.6.0_23/bin/java.

sudo ln -s /usr/bin/java /opt/jdk1.6.0_23/bin/java

, java "" JDK. ( .)

sudo mv /usr/bin/java /usr/bin/java_old

, /usr/bin java. , .

which java
+1

oracle java :

Java SE SDK.

http://www.oracle.com/technetwork/java/javase/downloads/index.html

:

tar -xzvf jdk-8-linux-x64.tar.gz
mv jdk1.8.0 /opt 
cd /opt/jdk1.8.0

Java :

update-alternatives --install /usr/bin/java java /opt/jdk1.8.0/bin/java 1
update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0/bin/javac 1
update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.8.0/jre/lib/amd64/libnpjp2.so 1
update-alternatives --set java /opt/jdk1.8.0/bin/java
update-alternatives --set javac /opt/jdk1.8.0/bin/javac
update-alternatives --set mozilla-javaplugin.so /opt/jdk1.8.0/jre/lib/amd64/libnpjp2.so

Test

Java,

java -version

java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

, http://www.java.com/ " Java?"

: https://askubuntu.com/questions/437776/ubuntu-13-04-unable-to-install-jdk7

+1

PATH, Terminal:

PATH=`echo $path`:/your/new/path
export PATH

If you lost the original PATH variable, you can restore it by entering this:

PATH = / usr / local / sbin: / usr / local / bin: / usr / sbin: / usr / bin: / sbin: / bin: / usr / games
export PATH
0
source

Try:

rm -rf /usr/bin/javac
rm -rf /usr/bin/jar 

ln -s /home/jdk1.6.0_13/bin/javac /usr/bin/javac 
ln -s /home/jdk1.6.0_13/bin/jar /usr/bin/jar 

So your Linux can find java && javac in /usr/bin

0
source

All Articles