LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 04-27-2005, 11:56 AM   #1
mayasedai
Member
 
Registered: Jan 2005
Location: scotland
Distribution: ubuntu
Posts: 51

Rep: Reputation: 15
trouble installing jdk1.5.0_02


i have installed the jdk following instructions on the java.sun.com/j2se/1.5.0/install-linux.html
the rpm was installed, there were no error messages, but the 'java -version' test failed : command not found

i treid to set the path by adding to /etc/profile the lines:
Code:
PATH="$PATH:/usr/java/jdk1.5.0_02/bin:."
export PATH
didnt work

i then chaged the path as directed on
www.linux.com/howtos/MMBase-Inst-HOWTO/x117.shtml
and created the java.sh file in /etc/profile.d

the contents of the file are

Code:
if ! echo ${PATH} | grep -q /usr/java/jdk1.5.0_02/bin ; then
    export PATH=/usr/java/jdk1.5.0_02/bin:${PATH}
    fi
  if ! echo ${PATH} | grep -q /usr/java/jdk1.5.0_02/jre/bin ; then
    export PATH=/usr/java/jdk1.5.0_02/jre/bin:${PATH}
    fi
  export JAVA_HOME=/usr/java/jdk1.5.0_02
  export CLASSPATH=.:/usr/java/jdk1.5.0_02/lib/tools.jar:/usr/java/jdk1.5.0_02/jre/lib/rt.jar
i also set its access rights with
Code:
 chown root:root /etc/profile.d/java.sh
 chmod 755 /etc/profile.d/java.sh
it still doesnt work = 'java' gives command not found

how do i get this working??
 
Old 04-27-2005, 02:24 PM   #2
sirclif
Member
 
Registered: Sep 2004
Location: south texas
Distribution: fedora core 3,4; gentoo
Posts: 192

Rep: Reputation: 30
did you restart your session, or source /etc/profile? after you change it you'll need to run it. does your path say it has the right directories.

echo $PATH

does this give you a string with the directories added? i alwasy add the lines in my ~/.bashrc file. I also thing that your classpath just needs to have the directory /usr/java/jdk1.50_02/lib in it.
 
Old 04-28-2005, 05:55 AM   #3
mayasedai
Member
 
Registered: Jan 2005
Location: scotland
Distribution: ubuntu
Posts: 51

Original Poster
Rep: Reputation: 15
thanks, on running and restarting it works.

echo gives:
Code:
[maya@172 maya]$ echo $PATH
/usr/java/jdk1.5.0_02/jre/bin:/usr/java/jdk1.5.0_02/bin:/usr/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin/:/usr/games:/usr/java/jdk1.5.0_02/bin:.:/home/maya/bin
Quote:
Originally posted by sirclif
I also thing that your classpath just needs to have the directory /usr/java/jdk1.50_02/lib in it.
i'm not sure how to code that (i just copied the previous bit from somewhere)
should i just add to etc/profile

Code:
PATH="$PATH:/usr/java/jdk1.5.0_02/lib:."
export PATH
do i need to do this even tho the java.sh file has the line
Code:
export CLASSPATH=.:/usr/java/jdk1.5.0_02/lib/tools.jar
 
Old 04-28-2005, 11:16 AM   #4
sirclif
Member
 
Registered: Sep 2004
Location: south texas
Distribution: fedora core 3,4; gentoo
Posts: 192

Rep: Reputation: 30
Code:
if ! echo ${PATH} | grep -q /usr/java/jdk1.5.0_02/bin ; then
    export PATH=/usr/java/jdk1.5.0_02/bin:${PATH}
    fi
  if ! echo ${PATH} | grep -q /usr/java/jdk1.5.0_02/jre/bin ; then
    export PATH=/usr/java/jdk1.5.0_02/jre/bin:${PATH}
    fi
  export JAVA_HOME=/usr/java/jdk1.5.0_02
  export CLASSPATH=.:/usr/java/jdk1.5.0_02/lib/tools.jar:/usr/java/jdk1.5.0_02/jre/lib/rt.jar
i would change the last line to
Code:
export CLASSPATH=.:/usr/java/jdk1.5.0_02/lib
you could just leave it as-is right now. it may work. however, if it is a problem, you will be getting some erros that look something like this:

Exception in thread "main" java.lang.NoClassDefFoundError: xxxxxxxx

in which case, you'll just need to make the change above.
 
Old 04-28-2005, 01:24 PM   #5
mayasedai
Member
 
Registered: Jan 2005
Location: scotland
Distribution: ubuntu
Posts: 51

Original Poster
Rep: Reputation: 15
Thumbs up

thanks!
 
Old 04-28-2005, 01:53 PM   #6
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 52
you don't need to specify the classpath and if i were you i would leave it alone, you really don't need it unless you are using "some kind of experimental jvm"
 
Old 04-29-2005, 05:20 PM   #7
sirclif
Member
 
Registered: Sep 2004
Location: south texas
Distribution: fedora core 3,4; gentoo
Posts: 192

Rep: Reputation: 30
are you sure? i get errors unless i specify it. doesn't it tell the system where the 'root' folder is for all the java packages you are going to call?
 
Old 04-29-2005, 05:32 PM   #8
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
Quote:
Originally posted by sirclif
are you sure? i get errors unless i specify it. doesn't it tell the system where the 'root' folder is for all the java packages you are going to call?
No, because it knows they're relative to the location of the java binary (i.e. at ../lib) or whatever.
 
Old 04-29-2005, 05:52 PM   #9
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
Here is a copy of my java.sh, it works fine on Slack, Fedora and CentOS,
Code:
#!/bin/sh
export JAVA_HOME=/opt/java
export MANPATH="$MANPATH:/opt/java/man"
export PATH="$PATH:/opt/java/bin:/opt/java/jre/bin"
Just change the paths so that they are the same as you java installation or create a symlink from your java diectory to /opt/java, log out and in again and java should work.
 
  


Reply



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
Anything I need to know before installing JDK1.5.0, Eclipse, and Dr. Scheme? Erik_the_Red Linux - Software 19 11-06-2005 08:26 AM
Java (JRE 1.5.0_02) - Symbolic Link Problem pacranch Amigo 1 04-14-2005 05:37 AM
Ask help on installing jdk1.3 on Redhat linux7.1! jane207 Linux - Software 8 11-05-2001 04:16 PM
JDK1.3 and Fonts cptfuture Linux - Software 2 05-26-2001 10:57 AM
Path for jdk1.3.0_02 oulevon Linux - Newbie 1 03-01-2001 08:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:01 PM.

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
Open Source Consulting | Domain Registration