1) Download jdk1.6.0_04 x64 version for Linux from http://java.sun.com
2) Add executable permission to the current user.
>chmod u+x jdk-6u4-linux-amd64.bin
3) Install the software
>./jdk-6u4-linux-amd64.bin
The JDK will be installed in the current working directory as jdk1.6.0_04. Therefore, if we want to install in /opt directory, switch to root and move the whole jdk1.6.0_04 directory to /opt
4) Set jdk as a default java.
>update-alternatives –install /usr/bin/java java /opt/jdk1.6.0_04/bin/java 300
>update-alternatives –config java
This setting will work for both root and normal user.
5) Add jdk java path to environment. This setting will work for normal user if we add java path to .bashrc in the normal user home.
- Create a new file called “.mysetup” in the home directory
>vi .mysetup
- Add the following lines to the “.mysetup” file
————————————–
JAVA_HOME=/opt/jdk1.6.0_04
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
—————————————-
- Save “.mysetup” file, and open “.bashrc” file in the home directory
>vi .bashrc
- Add the following line at the end of “.bashrc” file
———————————————
source ~/.mysetup
———————————————
- Save the “.bashrc” file and activate changes
>source .bashrc
error : I replaced “–install” with “–install” in order to work properly in the line where you write
update-alternatives –install /usr/bin/java java /opt/jdk1.6.0_04/bin/java 300
at end it works for me and thanx verry much. (i have debian etch).
when tryed to activating changes as root i got error, so i did that as usual user($).
source .bashrc
———————-
By the time, i’m new in Linux
Installation of JDk1.6.0_04 X64 on Debian Etch AMD64
I followed these instructions and all went well except for the above mentioned need for two dashes preceding the “install” and “config java”.
Neither Iceweasel nor Epiphany browsers see Java though. What would you recommend?
Regards, Dee
hi, it’s me again.
I installed jdk according to your useful blogs.
I’ve just installed Eclipse (3.2.), with the required packages (using: synaptic), but when I run the IDE from the menu, only an error message appears saying: “A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations:/usr/lib/j2sdk1.4-sun/bin/java”
———-
but when i run eclipse from the terminal it works fine, no errors, but if i close the terminal window, eclipse closes too (it’s natural).
———-
The solution i’ve found is: editing the /etc/eclipse/java_home file and add the location of your java virtual machine at the top e.g. /opt/jdk1.6.0_04
———-
It’k worked for me, i hope this helps someone.