How to change which Java is used

Continuing the discussion from Which version of JAVA are you using?:

The MineOS scripts determine which java to use based on your PATH variables. You can see which binary it points to with the command which java.

That said, it probably points to /usr/bin/java. So you can either update your PATH variable with the export command, but preferably you can just change /usr/bin/java to point to your new installation:

Check to see if /usr/bin/java is in fact a symlink for your particular installation. If it is (use ls -la), then you can readily use these commands to repoint java.

rm /usr/bin/java
ln -s /usr/lib/jvm/jre1.8.0_51/bin/java /usr/bin/java

On the other hand, if you’re using Debian–or Debian-based Java–check for tutorials on how to change the default java. Instructions from these tutorials is preferred over the above commands, see also this Debian tut.

Since typing this I have reinstalled the OS using the new nodeJS ISO and had no trouble using the link you provided in the privious post

For those using Ubuntu 14.04 LTS that does not have a OpenJDK 8 package in the official repository.

Webup8 Oracle Java8 Installer

sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java8-installer

To automatically set up the Java 8 environment variables

sudo apt-get install oracle-java8-set-default

Check it

java -version

This also can be used update OpenJDK 8 via sudo apt-get install oracle-java8-installer it will clean up the old install. For those running Ubuntu 14.10 and up use sudo apt-get install openjdk-8-jre.

There are performance improvements to be had running a server with Java 8 not to mention developing mods. The only reason from an admin perspective to justify using an older version of Java is if a mod requires a lower version of Java. That is rare nowadays to the point Java 8 should be default in my personal opinion for MineOS.

are there updated instructions for installing new versions of java? some mods don’t run on 7, but i’m having trouble following along here and guessing that it’s because things have changed over the past months?

for example, if i go to /usr/bin, there isn’t a java folder. if i try to use which java, it reports no command found.

Where are you starting off with? MineOS works on every distro, so providing a single set of instructions that works across the board is not viable. When it comes to the Java distributed with the MineOS Turnkey ISOs, however, you have two options:

  1. Use the instructions outlined in this thread, or the links mentioned
  2. Use different instructions that doesn’t update OpenJDK, but instead installs ORACLE JDK.
  3. Use the more recently released, updated ISO that comes with Java8.

I personally recommend #1 (or #2 is equivalent). Clearing out a system only to update something that can be done much more easily in a few commands is preferred.

I followed the instruction from and it works fine.

Although I had some “Additional Java arguments:” which dident work with the newly installed java version, so I had to clear those first.
But after that, it works fine,

su -
echo “deb trusty main” | tee /etc/apt/sources.list.d/webupd8team-java.list
echo “deb-src trusty main” | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver hkp:// --recv-keys EEA14886
apt-get update
apt-get install oracle-java8-installer

Of course ideally I would follow the instructions provided here, but they don’t work for me. I have the MineOS plugin installed on a FreeNAS 9.2 machine, which I think might eliminate a new ISO since I don’t have an option to direct it to a specific ISO when it installs itself.

Yes, unfortunately while it works on FreeBSD 9.3, it doesn’t work on FreeNAS for really uncertain reasons. The actual author of the MineOS plugin for FreeNAS (josh4trunks) writes about it here: