Java versions issue - Open Fire 4.0.3

Ubuntu Linux, fresh installation. Running the latest Oracle Java:

java version “1.8.0_101”

Java™ SE Runtime Environment (build 1.8.0_101-b13)

Java HotSpot™ 64-Bit Server VM (build 25.101-b13, mixed mode)

When trying to install via the deb file, the installer requires the installation of “default-jre-headless”. When installing this via apt-get, the version which is installed is Java 7. When running the following command:

“update-alternatives --config java”

I get the following:

Selection Path Priority Status


0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 auto mode

1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode

  • 2 /usr/lib/jvm/java-8-oracle/jre/bin/java 2 manual mode

But when opening the Open Fire web interface, I see the following:

Java Version:
1.7.0_111 Oracle Corporation – OpenJDK 64-Bit Server VM

Any ideas how to force OP to use the correct version?

Thanks!

Edit /etc/default/openfire and set JAVA_HOME

This did not work. I have updated the file to show the following:

JAVA_HOME= /usr/lib/jvm/java-8-oracle/jre/bin/java

Restarted OpenFire via this command:

sudo service openfire restart

Got this in the output:

Usage: java [-options] class [args…]

(to execute a class)

or java [-options] -jar jarfile [args…]

(to execute a jar file)

where options include:

-d32 use a 32-bit data model if available

-d64 use a 64-bit data model if available

-server to select the “server” VM

The default VM is server,

because you are running on a server-class machine.

-cp <class search path of directories and zip/jar files>

-classpath <class search path of directories and zip/jar files>

A : separated list of directories, JAR archives,

and ZIP archives to search for class files.

-D=

set a system property

-verbose:[class|gc|jni]

enable verbose output

-version print product version and exit

-version:

Warning: this feature is deprecated and will be removed

in a future release.

require the specified version to run

-showversion print product version and continue

-jre-restrict-search | -no-jre-restrict-search

Warning: this feature is deprecated and will be removed

in a future release.

include/exclude user private JREs in the version search

-? -help print this help message

-X print help on non-standard options

-ea[:…|:]

-enableassertions[:…|:]

enable assertions with specified granularity

-da[:…|:]

-disableassertions[:…|:]

disable assertions with specified granularity

-esa | -enablesystemassertions

enable system assertions

-dsa | -disablesystemassertions

disable system assertions

-agentlib:[=]

load native agent library , e.g. -agentlib:hprof

see also, -agentlib:jdwp=help and -agentlib:hprof=help

-agentpath:[=]

load native agent library by full pathname

-javaagent:[=]

load Java programming language agent, see java.lang.instrument

-splash:

show splash screen with specified image

See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.

best java alternative in: /usr/lib/jvm/java-7-openjdk-amd64/jre

Restarting openfire: openfire.

Viewing the Java version on the admin page shows:

1.7.0_111 Oracle Corporation – OpenJDK 64-Bit Server VM

This should show version 1.8.0

JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre

I get this error after restarting the server:

/etc/init.d/openfire: 11: /etc/default/openfire: /usr/lib/jvm/java-8-oracle/jre: Permission denied

best java alternative in: /usr/lib/jvm/java-7-openjdk-amd64/jre

I am unsure what to say


# cat /etc/debian_version

jessie/sid

# grep JAVA_HOME /etc/default/openfire

# If you wish to override the auto-detected JAVA_HOME variable, uncomment

JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre

# ps auxw | grep java

openfire  2857  6.8  7.5 2182568 76936 ?       Sl   12:55   0:02 /usr/lib/jvm/java-8-oracle/jre/bin/java -server -DopenfireHome=/usr/share/openfire -Dopenfire.lib.dir=/usr/share/openfire/lib -classpath /usr/share/openfire/lib/startup.jar -jar /usr/share/openfire/lib/startup.jar

Oh, be sure there is no space after the equals sign in “JAVA_HOME= /usr…”

I noticed a “Permission denied” in that error message. Does the user that’s running Openfire have enough permissions to execute Java on your system?

It was the space… Now OF server show the proper Java version. Thanks!