tags:

views:

286

answers:

4

Is there any linux command I could use to find out JAVA_HOME directory? I've tried print out the environment variables ("env") but i cant find the directory.

A: 

Perhaps it's not set....try setting the value. It used to be done in the .cshrc on Unix, if I recall correctly. Is that still true of Linux?

duffymo
C shell(?sp) is unlikely to be run on Linux. bash is the usual one.
Tom Hawtin - tackline
+2  A: 

'echo $JAVA_HOME' will print the value if its set. However, if you didn't set it manually in your startup scripts, it probably isn't set.

if you try 'which java' and it doesn't find anything, java may not be installed on your machine, or at least isn't in your path. Depending on which distro you have and whether or not you have root access, you can go to http://www.java.com to download the version you need. Then, you can set JAVA_HOME to point to this directory. Remember, that this is just a convention and shouldn't be used to determine if java is installed or not.

AdamC
A: 

On the Terminal, type:

echo "$JAVA_HOME"

If you are not getting anything, then your environment variable JAVA_HOME has not been set. You can try using "locate java" to try and discover where your installation of Java is located.

Michael Aaron Safyan
A: 

Did you set your JAVA_HOME

  • Korn and bash shells:export JAVA_HOME=jdk-install-dir
  • Bourne shell:JAVA_HOME=jdk-install-dir;export JAVA_HOME
  • C shell:setenv JAVA_HOME jdk-install-dir
Nizar Grira
Are you missing a semicolon there?
Tom Hawtin - tackline
Fixed, thanks Tom
Nizar Grira