Set custom JAVA_HOME path

Well hello there

Coming from ubuntu that it was just an entry in bashrc file , i am struggling to enter a custom path for the JAVA_HOME entry .

I had tried to put the lines below in :

  • .bashrc
  • .zshrc
  • make a shell script and run it
export JAVA_HOME="/home/tsofras/work/dev/tools/Java/jdk-1.8"
export PATH=$JAVA_HOME/bin:$PATH

When i try the java -version i am still getting the java17 instead of my java 1.8
What else i have to do in order to use my 1.8 jdk as my current java ?

Is the /bin corrrect there?

Yes it is , thank you for your time man i had just fixed it
Too noob mistake as i had copied the windows jdk from a backup drive :frowning:

Sorry about that and thanks again for your help

1 Like

Meh. Stuff happens.

:man_shrugging:

1 Like

Looking at /bin/java on my machine I can see it’s a symlink to /usr/lib/jvm/default-runtime/bin/java which is itself a symlink to /usr/lib/jvm/java-8-openjdk/jre/bin/java.

So at a guess you may need to make some changes to the symlinks.

1 Like
sudo pacman -S jdk8-openjdk
sudo archlinux-java set java-8-openjdk

https://wiki.archlinux.org/title/Java#Switching_between_JVM

2 Likes