LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-04-2003, 10:30 PM   #1
unwrittenlaw
Member
 
Registered: Sep 2003
Distribution: Slackware FreeBSD Gentoo Novell
Posts: 73

Rep: Reputation: 15
Java Install Please Help!!!


I need help on setting the path on my java. is located on /usr/java/j2sdk...etc... and i just need help on setting my PATH thank you so much
 
Old 11-04-2003, 10:36 PM   #2
LogicG8
Member
 
Registered: Jun 2003
Location: Long Island, NY
Distribution: Gentoo Unstable (what a misnomer)
Posts: 380

Rep: Reputation: 30
To have every user on the system have java in their path
edit /etc/profile and append the path to your java installation
to the path specified there.

Or for just your user edit ~/.bash_profile
and add
export PATH=$PATH:/path/to/java
 
Old 11-04-2003, 10:43 PM   #3
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
http://www.linuxquestions.org/questi...highlight=java

the second post will tell you how to edit your /etc/profile to make the path acessible system wide.

at minimum you'll need to open a new shell terminal. at most, you may have to log out and log back in.
 
Old 11-04-2003, 10:45 PM   #4
unwrittenlaw
Member
 
Registered: Sep 2003
Distribution: Slackware FreeBSD Gentoo Novell
Posts: 73

Original Poster
Rep: Reputation: 15
how do i start that
 
Old 11-04-2003, 10:51 PM   #5
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
how do you start what?
 
Old 11-05-2003, 12:59 AM   #6
unwrittenlaw
Member
 
Registered: Sep 2003
Distribution: Slackware FreeBSD Gentoo Novell
Posts: 73

Original Poster
Rep: Reputation: 15
How do i start everything...im lost and confused and dont know whats going on and i need help on setting my PATH on my java
 
Old 11-05-2003, 01:41 AM   #7
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
open up a shell terminal console and type these commands:

1. su
<enter root password>
2. kwrite /etc/profile

look over that link in my post and add the last three lines in the code block to the area it tells you to in the post.

3. save your changes
4. exit
5. exit

and open up a new shell terminal:

6. java -version

if you get output, you're good to go. if it says command not found, try logging out and logging back in. open a shell terminal and redo step 6.

also what version of java are you using (the numbers after j2sdk)? the path will be slightly different.

JAVA_HOME=/usr/java/j2sdk1.4.2_01

the part in bold is what you're going to need to change to match your j2sdk version. ie., for example j2sdk1.4.2_02 ...
 
Old 11-05-2003, 01:47 AM   #8
lifted_one
LQ Newbie
 
Registered: Nov 2003
Location: phx
Distribution: Mandrake 9.1; Redhat 9
Posts: 9

Rep: Reputation: 0
Quote:
Originally posted by unwrittenlaw
How do i start everything...im lost and confused and dont know whats going on and i need help on setting my PATH on my java
Yup. It was a little unclear to me to at first too.

Assuming that your SDK is in "/usr/java/j2sdk"
1. you need to execute the following two lines before you use the "javac" compiler or "java" interpreter:
***************************
export PATH=$PATH:/usr/java/j2sdk/bin:.
export CLASSPATH=/usr/java/j2sdk/lib:.
***************************
no spaces before or after the equals sign!
don't forget the periods at the end!

To double check if these two variables were modified do a:
echo $PATH
echo $CLASSPATH

Now...
Add those two "export" statements to the very bottom of your "~/.bash_profile" file (In other words /home/username/.bash_profile). That way they will be executed everytime you log in.
 
Old 11-05-2003, 08:13 PM   #9
unwrittenlaw
Member
 
Registered: Sep 2003
Distribution: Slackware FreeBSD Gentoo Novell
Posts: 73

Original Poster
Rep: Reputation: 15
Im very sorry im very confused ....this is what i have my /etc/profile...
# /etc/profile -*- Mode: shell-script -*-
# (c) MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com>

loginsh=1

# Users generally won't see annoyng core files
[ "$UID" = "0" ] && ulimit -S -c 1000000 > /dev/null 2>&1

if ! echo ${PATH} |grep -q /usr/X11R6/bin ; then
PATH="$PATH:/usr/X11R6/bin"
fi

if [ "$UID" -ge 500 ] && ! echo ${PATH} |grep -q /usr/games ; then
export PATH=$PATH:/usr/games
fi

umask 022

USER=`id -un`
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HISTCONTROL=ignoredups
HOSTNAME=`/bin/hostname`
HISTSIZE=1000

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi

# some old programs still use it (eg: "man"), and it is also
# required for level1 compliance for LI18NUX2000
NLSPATH=/usr/share/locale/%l/%N

export PATH PS1 USER LOGNAME MAIL HOSTNAME INPUTRC NLSPATH
export HISTCONTROL HISTSIZE

for i in /etc/profile.d/*.sh ; do
if [ -x $i ]; then
. $i
fi
done

unset i
my point is where am i goin to put the three line i look on your post???
 
Old 11-06-2003, 12:35 AM   #10
lifted_one
LQ Newbie
 
Registered: Nov 2003
Location: phx
Distribution: Mandrake 9.1; Redhat 9
Posts: 9

Rep: Reputation: 0
OK. we are almost there...

the two lines:
export PATH=$PATH:/usr/java/j2sdk/bin:.
export CLASSPATH=/usr/java/j2sdk/lib:.

should go at the very bottom of "/etc/profile"

However, I chose to put those two lines in my ".profile" file.
Whis located in my /home/username directory.
username being whatever username you are logged in at the time.
(/home/joe/.profile)
and yes, my .profile has only these two lines in it.

The difference is that when you put the PATH and CLASSPATH definitions into /etc/profile, the java tools are defined for every user.

If you put those two lines in your /home/username/.profile then java will be defined only for you.

I am running Mandrake 9.1.
 
Old 11-06-2003, 01:19 AM   #11
unwrittenlaw
Member
 
Registered: Sep 2003
Distribution: Slackware FreeBSD Gentoo Novell
Posts: 73

Original Poster
Rep: Reputation: 15
Everyone Thanks alot for your help...but i just one question...i installed java and everything but my question is how to create a file for example 'java.sh' as 'root' in '/etc/profile.d' and has to contain this file
JAVA_HOME=/usr/java/j2sdk1.4.0
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH
how do i create that file and put that in that file....thank so much again
 
Old 11-06-2003, 01:32 AM   #12
lifted_one
LQ Newbie
 
Registered: Nov 2003
Location: phx
Distribution: Mandrake 9.1; Redhat 9
Posts: 9

Rep: Reputation: 0
Quote:
Originally posted by unwrittenlaw
'java.sh' as 'root' in '/etc/profile.d'
Well, this is where my Linux patience ends.
I really don't see why you can't just put those two PATH and CLASSPATH statements in your /home/username/.profile
It worked for me. You are running Mandrake right?
 
Old 11-06-2003, 01:38 AM   #13
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
hmmm... you don't have to do every way suggested. choose one of the suggestions and implement it. if you decide to export the paths in your $HOME/.bash_profile, then you don't have to worry about that shell script or editing your /etc/profile. if you decide to edit /etc/profile, then you don't have to worry about $HOME/.bash_profile or that shell script. as a matter of fact there's no reason to write a shell script for this. just pick a way and do it.
 
Old 11-06-2003, 02:03 AM   #14
unwrittenlaw
Member
 
Registered: Sep 2003
Distribution: Slackware FreeBSD Gentoo Novell
Posts: 73

Original Poster
Rep: Reputation: 15
yes i am running mandrake and yeah i could and i would put that PATH and Classpath but the thing is i dont know how too and i would like to learn how and i barely started using linux last night....so lifted_one can you show me too put the PATH CLASSPATH thing on my /home/username/.profile please and thank you
 
Old 11-06-2003, 01:11 PM   #15
lifted_one
LQ Newbie
 
Registered: Nov 2003
Location: phx
Distribution: Mandrake 9.1; Redhat 9
Posts: 9

Rep: Reputation: 0
you need to open the file called ".profile"
(which is located in /home/username/) with a text editor. "username" being whatever you logged in as. I'll assume "joe". So we will be editing /home/joe/.profile
If you are running a fairly new version of Mandrake then you should have either "gedit" or "kwrite" text editors installed.

At a command prompt type:
gedit /home/joe/.profile
or
kwrite /home/joe/.profile

Don't worry if the text editor shows you a blank file. That just means that there have been no modifications to that file yet. Thats how mine was before I put my PATH and CLASSPATH definitions in.

Then, once that file is opened in the text editor, put these two lines in:
export PATH=$PATH:/usr/java/j2sdk/bin:.
export CLASSPATH=/usr/java/j2sdk/lib:.

Save and restart the computer.
Then at the command prompt type:
echo $PATH
echo $CLASSPATH

Your paths should be there.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
java does not install in opt but install in usr bbmak Linux - Software 6 10-03-2005 12:13 AM
what directory is java install? what CMD determined where java is install? Thks. suse2166 Linux - Newbie 2 09-04-2005 09:24 PM
How Do you install Java? wizjr1 Fedora 3 07-03-2004 09:52 AM
Java Install marlaina1 Linux - Software 5 03-22-2004 12:58 PM
Help with java install (again...) MidgetmanUK Linux - Newbie 3 10-04-2003 09:36 AM


All times are GMT -5. The time now is 06:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration