Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Development & Programming > Programming Talk
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Programming Talk
This forum is for all programming questions.
The questions do not have to be directly related to Ubuntu and any programming language is allowed.

 
Thread Tools Display Modes
Old July 17th, 2006   #1
DapperDrakeNewbieDR
5 Cups of Ubuntu
 
DapperDrakeNewbieDR's Avatar
 
Join Date: Jul 2006
Beans: 24
Ubuntu 9.10 Karmic Koala
Need Help on JAVA_HOME, CLASSPATH set up

I need step-by-step instructions on how to set up the JAVA_HOME and CLASSPATH variables. Can anyone help me out with this issue?

Thanks in advance.
DapperDrakeNewbieDR is offline   Reply With Quote
Old July 18th, 2006   #2
tedwardo2
5 Cups of Ubuntu
 
Join Date: Apr 2006
Beans: 10
Re: Need Help on JAVA_HOME, CLASSPATH set up

it depends on what implementation of java you have installed, where it is installed, and a number of other things.

If you already know what you want to set JAVA_HOME and CLASSPATH to, you can just run
Code:
sudo gedit /etc/environment
and then add a line for each variable.
tedwardo2 is offline   Reply With Quote
Old July 18th, 2006   #3
DapperDrakeNewbieDR
5 Cups of Ubuntu
 
DapperDrakeNewbieDR's Avatar
 
Join Date: Jul 2006
Beans: 24
Ubuntu 9.10 Karmic Koala
Re: Need Help on JAVA_HOME, CLASSPATH set up

Thanks tedwardo2, it worked perfectly fine.

See you around.
DapperDrakeNewbieDR is offline   Reply With Quote
Old October 22nd, 2006   #4
DapperDrakeNewbieDR
5 Cups of Ubuntu
 
DapperDrakeNewbieDR's Avatar
 
Join Date: Jul 2006
Beans: 24
Ubuntu 9.10 Karmic Koala
Re: Need Help on JAVA_HOME, CLASSPATH set up

This is the output of the "etc/environment" file after I "gedit" it,

Code:
PATH="/usr/local/Java/jdk1.5.0_07/bin:.:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games"
LANG="en_AU.UTF-8"
LANGUAGE="en_AU:en"
JAVA_HOME="/usr/local/Java/jdk1.5.0_07"
CLASSPATH="/usr/local/Java/jdk1.5.0_07/lib:."
It may serve you as a guide to you folks looking for help.

Last edited by DapperDrakeNewbieDR; October 22nd, 2006 at 05:43 PM..
DapperDrakeNewbieDR is offline   Reply With Quote
Old July 23rd, 2007   #5
erpa
First Cup of Ubuntu
 
Join Date: Jul 2007
Beans: 6
Re: Need Help on JAVA_HOME, CLASSPATH set up

i'm having the same problem, but i don't know exactly what to do. i installed jdk and jre trough apt-get but i can't find "/usr/local/Java/jdk1.5.0_07/bin:." or any of the others path you used.
The best i was able to do was to find the java folder in usr/share but i can't find anything like jdk1.5.0_07/bin:. in it. This is the content of the java folder :



wich path should i use? doi need to install somtging else? atm the content of my etc/environment is:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
LANG="it_IT.UTF-8

thx in advice for help

P.S. sry for may bad english
erpa is offline   Reply With Quote
Old July 24th, 2007   #6
steve.horsley
Chocolate-Covered Ubuntu Beans
 
steve.horsley's Avatar
 
Join Date: Jun 2005
Location: London, England
Beans: 2,312
Kubuntu 7.10 Gutsy Gibbon
Re: Need Help on JAVA_HOME, CLASSPATH set up

The easiest way to find it is to use the command
whcih java
which probably says /usr/bin/java, but this is a symlink. if you do
ls -l /usr/bin/java
it will tell you where it links to (probably another symlink). Keep on followinf the symlinks until you find the real executable. It's there somewhere.

If you install java straight from Sun, it defaults into /opt/java..., but the Ubuntu packagers tend to put java in /usr/lib or /usr/share or something like that.

P.S.
With the Sun JRE, you don't normally need to set JAVA_HOME or CLASSPATH at all.
steve.horsley is offline   Reply With Quote
Old May 21st, 2008   #7
akhilanger
First Cup of Ubuntu
 
Join Date: May 2008
Beans: 1
Smile Re: Need Help on JAVA_HOME, CLASSPATH set up

If you have installed java through sudo apt-get install ......
then it is installed in /usr/lib/jvm
akhilanger is offline   Reply With Quote
Old June 30th, 2008   #8
bwakkie
5 Cups of Ubuntu
 
bwakkie's Avatar
 
Join Date: Jul 2007
Location: Brussels
Beans: 22
Ubuntu 9.04 Jaunty Jackalope
Re: Need Help on JAVA_HOME, CLASSPATH set up

euhm.. is my case:

which java
/usr/bin/java

ls -l /usr/bin/java
/usr/bin/java -> /etc/alternatives/java

ls -l /etc/alternatives/java
/etc/alternatives/java -> /usr/lib/jvm/java-gcj/jre/bin/java

Changed that to:
java -> /usr/lib/jvm/java-6-sun-1.6.0.06/jre/bin/java


then I added the following line to /etv/environment:
JAVA_HOME="/usr/lib/jvm/java-6-sun-1.6.0.06/"

and created the following symlink:
/usr/java/jdk -> /usr/lib/jvm/java-6-sun-1.6.0.06/

although I have both... java is sooooo confusing!!
__________________
HW: Intel Core 2 CPU T7400 @ 1.66GHz, Dell Latitude D620, Intel Mobile 945GM/PM/GMS 943/940GML Express IGP + ICH7-M, 2014MB, 160GB, 1280x800 -- OS: Gentoo 2004-2010 & Ubuntu 7.4-9.10

Last edited by bwakkie; June 30th, 2008 at 09:54 AM..
bwakkie is offline   Reply With Quote
Old September 15th, 2008   #9
elnur
5 Cups of Ubuntu
 
elnur's Avatar
 
Join Date: Apr 2007
Beans: 23
Ubuntu 9.04 Jaunty Jackalope
Wink Re: Need Help on JAVA_HOME, CLASSPATH set up

Quote:
Originally Posted by bwakkie View Post
Changed that to:
java -> /usr/lib/jvm/java-6-sun-1.6.0.06/jre/bin/java

and created the following symlink:
/usr/java/jdk -> /usr/lib/jvm/java-6-sun-1.6.0.06/
You really shouldn't. Just run this command:
Code:
sudo update-java-alternatives -s java-6-sun
It will set java-6-sun to be run by default.
elnur is offline   Reply With Quote
Old December 5th, 2008   #10
Juzz
A Carafe of Ubuntu
 
Juzz's Avatar
 
Join Date: Apr 2005
Location: Valby, Denmark
Beans: 128
Ubuntu 9.10 Karmic Koala
Red face Re: Need Help on JAVA_HOME, CLASSPATH set up

Quote:
Originally Posted by elnur View Post
You really shouldn't. Just run this command:
Code:
sudo update-java-alternatives -s java-6-sun
It will set java-6-sun to be run by default.
Why does java on linux have to be so obscure?

I was wondering why my netbank didn't work anymore - but when I ran java --version gcj had stolen my settings from sun being default...

Even after running that command to set java alternatives firefox hangs and uses up 100% cpu time when trying to access my netbank
Juzz is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:32 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry