2

Tried setting sym links and all but didn't work. It is pointing to a read only file system.

bash-4.1$ sudo ln -s /scratch/mbhamba/work/jdk1.8.0_40/bin/java /usr/bin/java

bash-4.1$ which java /usr/dev_infra/platform/bin/java bash-4.1$ sudo rm -f /usr/dev_infra/platform/bin/java rm: cannot remove /usr/dev_infra/platform/bin/java': Read-only file system

bash-4.1$ sudo ln -sf /scratch/mbhamba/work/jdk1.8.0_40/bin/java /usr/dev_infra/platform/bin/java ln: cannot remove /usr/dev_infra/platform/bin/java': Read-only file system

2
  • 1
    instead of trying to remove or soft link the path , add the new path to the $PATH variable at start Commented Jul 1, 2015 at 5:59
  • 1
    What distribution are you using? Commented Jul 1, 2015 at 8:19

2 Answers 2

6

I suggest you set (and use) the environment variables JAVA_HOME1 and PATH2 (with , you can usually set them in your $HOME/.bashrc)

export JAVA_HOME="/scratch/mbhamba/work/jdk1.8.0_40"
export PATH="$JAVA_HOME/bin:$PATH"

1The Java home variable is honored by JBoss and eclipse (as well as other common Java projects & containers).
2The PATH controls where, and the order in which, bash looks for executable commands.

Sign up to request clarification or add additional context in comments.

Comments

1

I would propose another solution, without touching the system default /usr/bin/java.

Change for the user mbhamba the login script and amend the PATH setting to

export PATH=/scratch/mbhamba/work/jdk1.8.0_40/bin/:${PATH}

That way the JDK 1.8.0_40 would be taken if you compile and execute your code.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.