1

I have the latest version of Java installed on my system.

  • But I wonder why when I run any program, the location from where java executes is /usr/java/latest/bin/java instead of /usr/bin/java.

    [prompt ~]$ which java
    /usr/bin/java
    
    [prompt ~]$ ls -l /usr/bin/java
    lrwxrwxrwx 1 root root 22 Jul 23 15:13 /usr/bin/java -> /etc/alternatives/java
    
    [prompt ~]$ ps -ef | grep tomcat
    www      11279     1  0 Jul23 ?        00:02:12 /usr/java/latest/bin/java -D...
    

Is there a way that I can set where java should execute from?

  • (In my case, I want it to execute from /usr/bin/java)
2

1 Answer 1

1

To my surprise, even though my environment profile files did not have any setting of JAVA_HOME, it was pointing to /usr/java/latest:

[prompt ~]$ echo $JAVA_HOME
/usr/java/latest
[prompt ~]$ printenv | grep JAVA_HOME
JAVA_HOME=/usr/java/latest

No wonder why it was actually executing java from /usr/java/latest directory.

All I did was remove the entry in environment variables and the issue was fixed, java began executing from /usr/bin/java.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .