LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Mandriva (https://www.linuxquestions.org/questions/mandriva-30/)
-   -   finding out the java version (https://www.linuxquestions.org/questions/mandriva-30/finding-out-the-java-version-445209/)

TuxLives 05-15-2006 10:46 PM

finding out the java version
 
How do i find out my java version?

I saw something that said

# java --version

but it does not like it.

gilead 05-15-2006 11:28 PM

I think you have too many dashes - have you tried java -version instead?

TuxLives 05-16-2006 12:03 PM

Quote:

Originally Posted by gilead
I think you have too many dashes - have you tried java -version instead?

java -version
bash: java: command not found

rickh 05-16-2006 02:05 PM

Looks like you don't have Java installed. If you're sure you do have it installed, it must not be resident on your $PATH.

gilead 05-16-2006 02:06 PM

Code:

find / -type f -name java 2>/dev/null

TuxLives 05-16-2006 07:40 PM

Quote:

Originally Posted by gilead
Code:

find / -type f -name java 2>/dev/null

Here is what i got

find / -type f -name java 2>/dev/null
/usr/java/jre1.5.0_06/bin/java
/usr/java/jdk1.5.0_06/bin/java
/usr/java/jdk1.5.0_06/jre/bin/java

ANd

whereis java
java: /etc/java /usr/share/java

gilead 05-16-2006 07:49 PM

Then I'm guessing that running /usr/java/jdk1.5.0_06/bin/java -version will return something similar to:
Code:

java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

Which one you run probably doesn't matter, although I'd expect if you're writing code you'll be interested in the stuff under /usr/java/jdk1.5.0_06. You could add environment variables to your ~/.bash_profile file like these:
Code:

export JAVA_HOME=/usr/java/jdk1.5.0_06
export PATH=$PATH:$JAVA_HOME/bin

Hope that helps...

TuxLives 05-16-2006 07:59 PM

Quote:

Originally Posted by gilead
Then I'm guessing that running /usr/java/jdk1.5.0_06/bin/java -version will return something similar to:
Code:

java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

Which one you run probably doesn't matter, although I'd expect if you're writing code you'll be interested in the stuff under /usr/java/jdk1.5.0_06. You could add environment variables to your ~/.bash_profile file like these:
Code:

export JAVA_HOME=/usr/java/jdk1.5.0_06
export PATH=$PATH:$JAVA_HOME/bin

Hope that helps...

What I am trying to install is FREEMIND, which needs SUN or BLACKDOWN's >=1.4, but it cannot find it an fails to install.

Yes I get this returned

java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

gilead 05-16-2006 08:37 PM

I haven't used FREEMIND, but its docs should tell you which environment variables it needs set. Modifying your path with the following should at least let the install start:
Code:

export PATH=$PATH:/usr/java/jdk1.5.0_06/bin

TuxLives 05-16-2006 08:49 PM

ok, so where do I put this information? Me new to that depth of config.

is this in bash_profile?

gilead 05-16-2006 08:54 PM

Yes, if you add it to the .bash_profile file in your home directory, it will be available every time you login. You can type it into a terminal window and it will affect everything you do in that terminal window, it just won't be a permanent change.

TuxLives 05-16-2006 08:58 PM

Quote:

Originally Posted by gilead
Yes, if you add it to the .bash_profile file in your home directory, it will be available every time you login. You can type it into a terminal window and it will affect everything you do in that terminal window, it just won't be a permanent change.

Hmmm

here is what I have in there now

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME

so do I just add these lines, like so?

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME

export JAVA_HOME=/usr/java/jdk1.5.0_06
export PATH=$PATH:$JAVA_HOME/bin


It seems like there could be a collision with the $PATH variable

TuxLives 05-16-2006 09:09 PM

hey i took what you gave me and what I found on the freemind site and got it working.

Thanks for you help!!!

gilead 05-16-2006 09:46 PM

Congratulations - I'm glad it's working :)

reddazz 05-16-2006 09:55 PM

If you have several users on your system, you need to set the JAVA_HOME and its path globally. This can be done by using a script such as the one below, placing it in /etc/profile.d and making it executable.
Code:

#!/bin/sh
export JAVA_HOME=/opt/java
export MANPATH="$MANPATH:/opt/java/man"
export PATH="$PATH:/opt/java/bin:/opt/java/jre/bin"

/opt/java is where my java jdk is installed, so you would have to edit the paths so that they are the same as the ones on your machine.


All times are GMT -5. The time now is 09:56 PM.