I’m wondering how you get Ubuntu to register a different Java JRE/JDK that’s been “installed” in Ubuntu. I’ve placed both JRE & JDK 7 in my /usr/lib/jvm folder, (where the other Java versions, including OpenJDK are located), but I can’t get the system to understand that. I can execute with a long extension in Terminal, but not with something like “java X” X being the file name.
There’s a few ways that ‘register’ might apply to what you want to do. The bit that Ubuntu might consider ‘registered’ is with packages installed via APT and that should also reach through to the kind of ‘registration’ you want: I type a command at the terminal and it finds the program for me.
That second type uses a list of places that executable files might be, called PATH, that the shell will check for an executable matching your ‘java’ command. Check it with echo $PATH
in a terminal window.
You can add a directory to PATH just for one session of a terminal window by a command like PATH=$PATH:/new/directory
– where you see from echo $PATH
that each directory is separated by a ‘:’ – but long-lasting add-ons can be set in your user’s ~/.profile
script. When you login to a text session or open a terminal window, this script sets up your session and can add all the customisations you want.
You will also need to check that those binaries you’ve added to /usr/lib/jvm
have the ‘execute bit’ set. Check with ls -l
and read man chmod
to fully explain the Unix/POSIX basic permissions structures.
K3n.
Add the java binary (or symlink) to /usr/bin or /bin, you can rename it if you want to keep the original too. Alternatively you can use the alias command to make java the alias for your current “long command”. Aliases will show up in a file .aliases in your /home.