Install java on Linux through shell without apt-get
Follow the instructions:
- You have to download required jdk version from the site: http://java.sun.com/javase/downloads/index.jsp
Put the downloaded jdk into your required folder,
Here, I am creating a new folder as a java inside the /etc
folder and placing my jdk
inside the /etc/java
folder. It will look like /etc/java/jdk-6u21-linux-i586.bin
Now change the permission of your file through chmod
to accessing installer.txt file while extracting it. Change the permission by typing the following command on your terminal. sudo chmod +x jdk-6u21-linux-i586.bin
Now execute
the file by typing this command on your terminal like sudo ./jdk-6u21-linux-i586.bin
It will create a folder inside the /etc/java/
and it will looks like /etc/java/jdk1.6.0_21
And our java is install now we our going to setting the class path of our java for this what we have to do is. Just type this command on your terminal sudo gedit ~/.bashrc
and it will open a editor, and now we have to put export JAVA_HOME=/etc/java/jdk1.6.0_21
at the last line of our editor and after it we have to do is export PATH=$PATH:$JAVA_HOME/bin
It will looks like : export JAVA_HOME=/etc/java/jdk1.6.0_21export PATH=$PATH:$JAVA_HOME/bin
Now save it and close it. And restart your system or type it in your terminal source ~/.bashrc
Finally, our java is ready just type java -version on your terminal and it will return java version "1.6.0_21" Java(TM) SE Runtime Environment (build 1.6.0_21-b06) Java HotSpot(TM) Server VM (build 17.0-b16, mixed mode)
Related videos on Youtube
Remco van Grinsven
Updated on September 18, 2022Comments
-
Remco van Grinsven over 1 year
I'd like to run multicraft on one of my servers.
After some intensive debugging/installing I realised the server didn't yet have a Java Runtime Environment. I figured it would be easy to install, but that is where is was wrong.
sudo apt-get install sun-java6-bin sun-java6-jre sudo: apt-get: command not found
So I figured I had to get the installer through
wget
but I couldn't find an URL to do so.My Linux version is:
version 2.6.18-194.8.1.el5.028stab070.4PAE
root@rhel5-build-x32
gcc version 4.1.2 20080704
Red Hat 4.1.2-46So how do I install Java on Linux through the shell without
apt-get
?
When I try
yum
:yum install sun-java6-bin sun-java6-jre Determining fastest mirrors *** removed bits here *** Excluding Packages in global exclude list Finished Setting up Install Process No package sun-java6-bin available. No package sun-java6-jre available. Loaded plugins: fastestmirror Nothing to do