File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Linux / UNIX and the fly likes jdk1.3.0_02 PATH???????????? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "jdk1.3.0_02 PATH????????????" Watch "jdk1.3.0_02 PATH????????????" New topic

jdk1.3.0_02 PATH????????????

Sean Casey
Ranch Hand

Joined: Dec 16, 2000
Posts: 625
Frank, this question is definitely for you. So here goes. Everytime I open a bash shell, I have to type the command
export PATH:/usr/java/jdk1.3.0_02/bin:$PATH in order to get everything to work. Is there a way to edit the Path once and for all?
Next Question:
I looked up the javac file under usr/bin/ and I noticed that it was configured for Kaffee the old version of java, so I tried to edit it in order to put in the correct Path. I also edited the jar file, and the java file in the same way. I don't know if I helped or hurt anything by doing that. Do I need to configure those files somehow?
Finally I wrote a small program that had a gui and when I ran it I got an error about a font not found. The gui was supposed to have a JFrame with a textfield, and a textarea, but I only got the JFrame blank. If you could point me in the right direction on any of these I would appreciate it, and thanks for all your help thus far.
To be completely thorough here is the message I get when I type java -version at the bashprompt:
/usr/bin/java: /usr/java/jdk1.3.0_02/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/bin:/opt/bin:/usr/X11R6/bin:/home/scasey/bin: cannot execute: No such file or directory.
the jdk is installed in the following directory: /usr/java/jdk1.3.0_02
If anyone could clarify this for me I'd appreciate it. I'm going to try to read up on it in the mean time.

[This message has been edited by Sean Casey (edited March 01, 2001).]
Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
Assuming you are using Redhat 7.X, in your homw directory, type
ls -a (list all files), you should see a file .bash_profile.
Edit this file by adding your jdk directory to the end of the PATH variable.
Sean Casey
Ranch Hand

Joined: Dec 16, 2000
Posts: 625
I did that. I got the same response as my above response when I type java -version.
I edited the Path, not the BASH_ENV. Am I supposed to do anything with that?
ryan headley
Ranch Hand

Joined: Jun 28, 2000
Posts: 156
did you logout and log back in after editing .bash_login? I think you might even be able to type source .bash_login if you haven't. It's been a while.

Ryan Headley<br /><a href="" target="_blank" rel="nofollow"></a>
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
If you want everyone to have access to Java, regardless of how they login, you can amend the PATH setting in /etc/profile which is run before other scripts (.bash_profile, .login, .profile, .cshrc etc.). Just add your Java bin directory to the default PATH and you should be OK. Log in again and type "echo $PATH" to se what teh path is set to.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Sean Casey
Ranch Hand

Joined: Dec 16, 2000
Posts: 625
Okay I get the following when I run echo $PATH:
/usr/bin:/bin:/usr/X11R6/bin:/usr/local/bin:/opt/bin:/usr/X11R6/bin:/home/scasey/bin:/usr/lib/:/usr/java/jdk1.3.0_02/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/bin:/opt/bin:/usr/X 11R6/bin/

And when I type the command java -version I get the following:
/usr/bin/java:/usr/java/jdk1.3.0_02/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/bin:/opt/bin:/usr/X11R6/bin:/home/scasey/bin:/usr/lib/:/usr/java/jdk1.3.0_02/bin:/usr/bin:/bin:/usr/ X11R6/bin:/usr/local/bin:/opt/bin:/usr/X11R6/bin/:
No such file or directory
/usr/bin/java: exec: /usr/java/jdk1.3.0_02/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/bin:/opt/bin:/usr/X11R6/bin:/home/scasey/bin:/usr/lib/:/usr/java/jdk1.3.0_02/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr /local/bin:/opt/bin:/usr/X11R6/bin:
cannot execute: No such file or directory.
Now all of this seems like it's just too long. Should I modify it, and if so could someone explicitly tell me how I should do it. Finally if I use the command: export PATH=/usr/java/jdk1.3.0_02/bin:$PATH
and then when I type java -version, I get the correct information, but if I close the bash shell, then I'm back to square one. So if anyone has any answers for me I'd really appreciate it. I realize that some of this may be trivial, but I'm a newcomer, and I'm lost. I thank you all for your patience.
George Brown
Ranch Hand

Joined: Sep 26, 2000
Posts: 919
It sounds to me as though you are picking up a link to a missing file, or other executable named 'java' that is found before the 'java' in /usr/java/jdk1.3.0_02/bin .
After logging in, type 'which java' and see what the reply is. The 'which' command looks all along your path and tells you where the first instance of the named command resides. If you've deleted another version of java there could still be an unresolvable link to the old version still hanging around.
Sean Casey
Ranch Hand

Joined: Dec 16, 2000
Posts: 625
I issued the command and this was the response:
How do I edit the PATH to get that bad link out of there. I'm very new to linux, so please be explicit. Tbanks for your help.
- Sean
Sean Casey
Ranch Hand

Joined: Dec 16, 2000
Posts: 625
You were right about the bad link. I took care of it and now when I type which java, I get the right path, and java -version returns the correct info.
Thanks so much for your help everyone. I am however running into a new problem which I'll save for a new post.
Thanks again,
George Brown
Ranch Hand

Joined: Sep 26, 2000
Posts: 919
Sean, I think it's a good idea to maintain rather than delete the links in that context. You don't have to but this is what I do: I set /usr/bin/java to point at the new java area, so when I upgrade the jdk next time all I will need to do is alter the links and I'm all set up for java again.
Scott Stirling

Joined: Mar 05, 2001
Posts: 24
You had two problems.
1. Transvirtual's Kaffe JVM is installed by default if you do a full RedHat install. It happens to be named "java" and is installed in /usr/bin. I usually get rid of this on a new RedHat box by doing "rpm -e kaffe."
2. The PATH issue. Like the other person said, the Kaffe JVM was found first in your PATH. Another option you had there was to put the JDK/bin dir anyhere in your PATH before /usr/bin.
Sounds like you have it working now. Tip: If you change your .bash_profile and want to test the changes without logging out and in again, source it with the source command:
source ~/.bash_profile
This will load the bash changes dynamically.

Scott Stirling<BR>Author of <A HREF="" TARGET=_blank rel="nofollow">Java Server Pages Application Development</A>
Craig O'Brien

Joined: Feb 28, 2001
Posts: 21
I just solved this problem for myself so I
thought I would share. I am using Mandrake
7.2. Yes there is a default jdk called
Kaffe which is only 1.1. I installed the
jdk1.3.0_02 from sun and it worked when I
referenced the full path from the bash shell.
Bash is looking to certain directories for
shell scripts. type "echo $PATH" and it
will tell you where it is looking. Look in
those directories to find the kaffe's "java" "javac" etc. files and
replace them with your simple shell scripts.
All you need is the path to your jdk and command. You don't even need to remove kaffe
although I did.
mine looked like this:
/usr/jdk1.3/bin/java $1
--no lines on top or bottom.
I found mine in the /usr/bin. Just call it
java. now when you type java in bash it
will look for this script. the "$1" is the
first item you type after "java " just like
normal terminal input.
This is my hack and I'm sure it can be more
elegant. Look at other shell scripts. If I
am missing anything please let me know. My
system is working fine.

[This message has been edited by Craig O'Brien (edited March 28, 2001).]

Sun Certified Programmer for the Java 2 Platform<br />Senior Software Engineer<br />TechRx
I agree. Here's the link:
subject: jdk1.3.0_02 PATH????????????
It's not a secret anymore!