Home > Archive > Java Help > February 2006 > search for installed jdk:s on linux
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
search for installed jdk:s on linux
|
|
| Petterson Mikael 2006-02-20, 7:57 am |
| Hi,
I wonder if it is possible to search for installed jdk:s on linux?
Is there a command?
cheers,
//mikael
| |
| Allan Bruce 2006-02-20, 7:57 am |
|
"Petterson Mikael" <mikael.petterson@era.ericsson.se> wrote in message
news:dtc33t$rg$1@news.al.sw.ericsson.se...
> Hi,
>
> I wonder if it is possible to search for installed jdk:s on linux?
> Is there a command?
>
> cheers,
>
> //mikael
you could try:
which javac
to see if there is one accessible on the current path.
Allan
| |
| karlheinz klingbeil 2006-02-20, 7:00 pm |
| Petterson Mikael schrub am Montag, 20. Februar 2006
10:45 folgendes:
> Hi,
>
> I wonder if it is possible to search for installed
> jdk:s on linux? Is there a command?
>
> cheers,
>
As you can install java nearly anywhere on a Linux Box,
there is no simple command to find an installation.
Normally, as someone pointed out, try to find it in the
path, otherwise search in possible places
like /usr/lib or /usr/bin or maybe even /opt/
--
greetz Karlheinz Klingbeil (lunqual)
http://www.lunqual.de http://www.42pixels.de
http://www.rezeptbuch-pro.de
| |
| Rob Skedgell 2006-02-20, 7:00 pm |
| Allan Bruce wrote:
>
> "Petterson Mikael" <mikael.petterson@era.ericsson.se> wrote in message
> news:dtc33t$rg$1@news.al.sw.ericsson.se...
>
> you could try:
>
> which javac
>
> to see if there is one accessible on the current path.
If you have locate installed (and locatedb gets updated), you might try
locate -be java\[c\]
instead, as 'which java' will only show the first one found on $PATH (or
all on $PATH if you use 'which -a java'), and this is may well be a
symlink, so you could still have to run each in turn with '-version'. In
the example above 'javac' is written in the odd wildcard form as
'java\[c\]' because the locate(1) manpage states "If a pattern is a
plain string — it contains no metacharacters — locate displays all file
names in the database that contain that string anywhere."
Running the above here, I get:
[rob@dionysus ~]$ locate -be java\[c\]
/etc/alternatives/javac
/usr/bin/javac
/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/bin/javac
/usr/local/lib/jvm/jdk1.6.0_beta/bin/javac
/var/lib/rpm/alternatives/javac
From the directory names, I can tell that I have the 1.5.0_06 and
1.6.0-beta Java SDKs. 'which java' actually tells me less than 'java
-version', since the 'java' on my $PATH is a symbolic link.
If the directory names don't give any helpful information, you can of
course do '</full/path/to/>javac -version' for each.
There is almost certainly a better way to do this, and like the previous
suggestion, it relies on javac executable actually being called
'javac', not something else...
--
Rob Skedgell <rob+news@nephelococcygia.demon.co.uk>
GnuPG/PGP: 7DA3 1579 C0DD 8748 C05A B984 E2A2 3234 D14B 6DD7
|
|
|
|
|