[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Running Java program



On Tue, Dec 31, 2002 at 01:08:06AM +0330, Aryan Ameri wrote:
| On Tuesday 31 December 2002 00:28, Derrick 'dman' Hudson wrote:
| > On Tue, Dec 31, 2002 at 12:08:57AM +0330, Aryan Ameri wrote:
| > | which java tells me that my java is installed in /usr/bin/java while I
| > | installed my 1.4.1 JRE in /opt/java.sun.
| > | And java -version tells me that my version of java is 1.1.8 . Apparently,
| > | I have two versions of java installed on this machine. How can I
| > | explicitly point bash to use the 1.4.1 one instead of the 1.1.8 one?
| >
| > You have a few choices :
| >     .   use the absolute path
| 
| This is currently working, although it is a pain, but it works.
| 
| >     .   set up PATH so that the desired one is found first
| 
| I did that in /etc/profile (That's where you setup path isn't it? ), but with 
| no success.

It's one place you can set a shell's environment.  IIRC that file is
only used for "login" shells.

| >     .   create appropriate symlinks
| 
| good idea, but messy I believe.
| 
| >     .   remove 1.1.8.  It's too old anyways.
| 
| apt-get remove java didn't work. Have to figure out the name of the package.

jdk1.1

(use 'dpkg -S /usr/bin/java' or "dlocate", or dereference the symlinks
to find where the actual executable is and query on that file instead)

| >     .   use 'update-alternatives' to manage the existing symlinks
| >             (this is what I recommend, after you install the java package)
| 
| "update-alternatives --auto java" didn't do a thing, although it didn't give 
| me an error message either.

It won't unless you have another package installed that provides java.
Once you install the j2re1.3 or j2re1.4 package there will be more
than one provider of "java" for update-alternatives to switch between.

| How about making an alias in .bashrc ?

That would work as well.

On my system I have a number of scripts in ~/bin (which is first on my
path) named like java-1.2, java-1.3, java-1.4, javac-1.2, javac-1.3,
javac-1.4.  The scripts are really short just to set environment as
necessary (j2sdk 1.2 needs $JAVA_HOME set) and exec the java program
via the absolute path.  The purpose is to allow me to easily use
whichever java I want at the time.  Since I end up doing java
development I need to run different versions for testing.

HTH,
-D

-- 
Whoever gives heed to instruction prospers,
and blessed is he who trusts in the Lord.
        Proverbs 16:20
 
http://dman.ddts.net/~dman/

Attachment: pgpeAzxHN6nMy.pgp
Description: PGP signature


Reply to: