20120723 changing the jdk for opendj - plembo/onemoretech GitHub Wiki

title: changing the jdk for opendj link: https://onemoretech.wordpress.com/2012/07/23/changing-the-jdk-for-opendj/ author: lembobro description: post_id: 3100 created: 2012/07/23 17:27:12 created_gmt: 2012/07/23 21:27:12 comment_status: closed post_name: changing-the-jdk-for-opendj status: publish post_type: post

changing the jdk for opendj

It turns out that OpenDJ can be a stubborn little guy when it comes to what JDK (Java Developers Kit) it uses. Maybe I'm just crazy, but in my world we update our JDK installations from time to time -- particularly when we get a security alert from upstream. Unsurprisingly there are lots of apps out there that don't seem to get with that program and insist on continuing to run the JDK they were first installed with. OpenDJ is one of those. But there's an easy fix. You can run a utility called dsjavaproperties (found under $INSTALL_ROOT/bin) that will reconfigure the server to use whatever parameters you specify in the $INSTALL_ROOT/config/java.properties. One of these is default.java.home -- which you could make look like this in java.properties:

default.java.home=/usr/java/default/lib/jvm/java

After that just run dsjavaproperties without any arguments and the config will be updated (note the example above shows the path for the default OpenJDK java on a Red Hat Enterprise Linux system -- with the advent of OpenDJ 2.5 and OpenJDK 1.7 it now makes more sense to use Red Hat's package than the Sun/Oracle one). There's another undocumented "override" that will also work: Set OPENDS_JAVA_HOME to the jdk path desired. For example:

OPENDS_JAVA_HOME=/usr/lib/jvm/java
export OPENDJ_JAVA_HOME

Of the two methods I prefer the first because it doesn't require my editing the start-ds file.

Copyright 2004-2019 Phil Lembo