mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
03.48.2008 dffcd320297e23f6d95dad4c7b08a2c0a9c1893a
Fix for issue 2998 (Command ./bin/create-rc-script should not hard-code the OPENDS_JAVA_HOME in the script)

If the user specifies in the java.properties not to overwrite the environment the java properties specified in java.properties will take precedence over the variables set in the script. In general users using java.properties should use the overwrite mode (not doing it does not make much sense).

I have updated the code to set the OPENDS_JAVA_HOME in the rc script only if the user explicitly sets the java home in the create rc command line or if it is already set in the environment (and not systematically as it is today).

A bug with the name used for the environment variable of the java properties has also been fixed.
1 files modified
15 ■■■■■ changed files
opends/src/server/org/opends/server/tools/CreateRCScript.java 15 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/CreateRCScript.java
@@ -218,14 +218,6 @@
    else
    {
      javaHomeDir = System.getenv(SetupUtils.OPENDS_JAVA_HOME);
      if (javaHomeDir == null)
      {
        javaHomeDir = System.getenv("JAVA_HOME");
      }
      if (javaHomeDir == null)
      {
        javaHomeDir = System.getProperty("java.home");
      }
    }
@@ -258,16 +250,19 @@
      w.println("export INSTANCE_ROOT");
      w.println();
      if (javaHomeDir != null)
      {
      w.println("# Specify the path to the Java installation to use");
      w.println("OPENDS_JAVA_HOME=\"" + javaHomeDir + "\"");
      w.println("export OPENDS_JAVA_HOME");
      w.println();
      }
      if (javaArgs.isPresent())
      {
        w.println("# Specify arguments that should be provided to the JVM");
        w.println("JAVA_ARGS=\"" + javaArgs.getValue() + "\"");
        w.println("export JAVA_ARGS");
        w.println("OPENDS_JAVA_ARGS=\"" + javaArgs.getValue() + "\"");
        w.println("export OPENDS_JAVA_ARGS");
        w.println();
      }