Here is a simple way to configure Java in Ubunu Linux. After following these steps, commands like java and javac will be available in the terminal window.
- Download the JDK and unpack it somewhere on your system. Let’s use /home/user/bin as an example.
- Set the file you download to executable. You can do this by right-clicking the file, choose Properties->Permissions.
- Excecute the file by double-clicking it and choose “Run in terminal” . Say yes a few times and you’re done.
Now you need to make Java available in the path so you can use it from any terminal.
- Edit the file .bashrc under your home directory and add the following lines
export JAVA_HOME=/home/user/bin/jdk1.5.0_09
export PATH=$JAVA_HOME/bin:$PATH
- Open a new terminal window and type java -version to make sure you’re running the java version you expected. Type env and verify that PATH variable contains the path to the JDK that you exported before.
October 25, 2006 at 1:27 pm |
Gosh! Didn’t you ever heard from java-package and make-jpkg?
October 25, 2006 at 1:32 pm |
Not untill you posted that comment. Did you read the title of my blog? Thanks for the tip anyway, I found this website http://www.debian-administration.org/articles/142 and I am reading about it. Cheers!
October 25, 2006 at 1:38 pm |
Trying to follow what it says in that page but I cannot even get the java-package:
anh@anh-laptop:~$ sudo apt-get install fakeroot java-package
Password:
Reading package lists… Done
Building dependency tree… Done
E: Couldn’t find package java-package
October 25, 2006 at 1:51 pm |
I think java-package is in the “Universe” repository.
And don’t forget to execute
sudo update-alternatives –config java
sudo update-alternatives –config javac
October 25, 2006 at 2:32 pm |
Ok, I did this and now java -version gives me the correct version. I removed those exports from the .bashrc file but now maven does not find JAVA_HOME. So it is bad to do those exports anyway?
October 25, 2006 at 2:33 pm |
[...] Jump Start confessions of a newbie « Configuring Java in Ubuntu [...]
October 26, 2006 at 8:31 am |
I think the exports must be there. Don’t need to put java in the path though, cause the setup with make-jpkg takes care of that, but still have to have:
export JAVA_HOME=/usr/lib/j2sdk1.5-sun
export M2_HOME=/home/anh/bin/maven-2.0.4
export PATH=$M2_HOME/bin:$PATH
because maven needs to know where Java is.
October 31, 2006 at 4:02 pm |
This post has been deprecated
Please read the next one.
December 10, 2006 at 3:45 am |
A PITA to install java ‘by hand’. Especially when I already installed the 32bit version for web-use, and now want to have 64bit java for azureus. :-/
July 3, 2008 at 8:35 am |
Thanks yeah!!!! I could install java… I m not a newbie but was still facing lots of problem… and all was resolved following these simple steps religiously….
July 3, 2008 at 8:38 am |
sorry tht was posted by mistake its meant for another site
August 2, 2010 at 12:08 pm |
thanks very benificial thread for beginners
September 28, 2010 at 5:29 am |
I have download Java from java.com and installed, however could not get it working as the path was not set.
Followed your guide by setting the path in the .bashrc, which worked perfectly. Thank you very much!
May 16, 2011 at 4:51 pm |
Thanks .. this works.
The .bashrc is hidden file. So in “view” select “Show hidden files”
August 23, 2011 at 6:49 am |
How can i run the executable jar file on ubuntu startup.