Using java in FC1(with eclipse)-help needed
Matt Morgan
matt.morgan at brooklynmuseum.org
Wed Mar 17 15:43:37 UTC 2004
On 03/17/2004 01:03 AM, Kaustubh Ghosh wrote:
>On Wednesday 17 March 2004 12:51 am, Matt Morgan wrote:
>
>
>>On 03/16/2004 01:53 PM, Kaustubh Ghosh wrote:
>>
>>
>>>I am quite novice towards java programming in linux.To start with I
>>>installed j2re1.4.2_03 and also j2sdk1.4.2_04 in FC1(Both from
>>>java.sin.com).Now peculiar problems arise.
>>>When I type "java -version" it gives 1.3.1(
>>>
>>>
>>That's a path issue. You must also have the older version of java
>>installed, and it appears earlier (or exclusively) in your path. At a
>>shell prompt, type
>>
>>which java
>>
>>
>>
>
>It gives:" /usr/bin/java".I then cut out the java file and ran the command
>again it gave:"/usr/java/j2sdk1.4.2_04/bin/java".I again replaced the java
>file and on again issueing the command it gave:"/usr/bin/java".
>
>
Do you understand how $PATH works? Forgive me if this is too newbie for
you. When you type 'java' at a prompt, the shell looks through the
directories in your $PATH, in order, for a program called java. When
there's one in /usr/bin, it runs that one. When there isn't one in
/usr/bin, it proceeds through the $PATH until it finds one, or gives up.
Since the 1.4.2 version is also in your $PATH, the shell runs that one
when it can't find any other ones first.
Basically you have two javas installed. One of them is either the
program itself, or a link to the program, in /usr/bin. That one is the
1.3.1 version. The version you want is exactly where you think it is.
Probably you can get what you want to work by simply moving or deleting
the one in /usr/bin, although that may leave that version present
somewhere on your computer and confuse you later. You should also follow
the instructions regarding setting $JAVA_HOME in the other related
messages on this topic. That will help you make sure you're always
running the version you want to be running.
>>and you'll see where that version is (it'll be the first one that comes
>>up, if more than one comes up). You can also type
>>
>>echo $PATH
>>
>>to see what directories are in your path. You can easily add the
>>
>>
>>
>
>It showed:
>"/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/java/j2sdk1.4.2_04/bin:.:/usr/java/j2sdk1.4.2_03/bin:/root/bin"
>Now what can I do.
>
>
>
This is fine. You should leave your $PATH alone, in my opinion, and
continue with fixing $JAVA_HOME.
--Matt
More information about the fedora-list
mailing list