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. -Sean 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).]
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.
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.
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. Thanks, Sean
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.
George, I issued the command and this was the response: /usr/bin/java 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
George, 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, Sean
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.
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="http://www.amazon.com/exec/obidos/ASIN/067231939X/ref=ase_electricporkchop/107-2476442-4883722" TARGET=_blank rel="nofollow">Java Server Pages Application Development</A>
Hello, 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: ----------------------- #!bin/sh /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.
Regards, Craig ------------------ SCJP2 [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
LOOK! OVER THERE! (yoink) your tiny ad is now my tiny ad.
a bit of art, as a gift, that will fit in a stocking