From 69287099bab9640465cb18ef4006252d05a33e5d Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 28 Sep 2007 19:50:40 +0000
Subject: [PATCH] Fix for issue 2035 (Use OpenDS specific environment variables to determine the JVM to be used.)

---
 opends/src/server/org/opends/server/util/SetupUtils.java |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/opends/src/server/org/opends/server/util/SetupUtils.java b/opends/src/server/org/opends/server/util/SetupUtils.java
index 1bbe5ac..8351fb5 100644
--- a/opends/src/server/org/opends/server/util/SetupUtils.java
+++ b/opends/src/server/org/opends/server/util/SetupUtils.java
@@ -57,6 +57,11 @@
   public static final String IS_WEBSTART = "org.opends.quicksetup.iswebstart";
 
   /**
+   * Specific environment variable used by the scripts to find java.
+   */
+  public static final String OPENDS_JAVA_HOME = "OPENDS_JAVA_HOME";
+
+  /**
    * Java property used to know which are the jar files that must be downloaded
    * lazily.  The current code in WebStartDownloader that uses this property
    * assumes that the URL are separated with an space.
@@ -221,10 +226,10 @@
 
   /**
    * Write a set-java-home file appropriate for the underlying platform that may
-   * be used to set the JAVA_HOME environment variable in a form suitable for
-   * the underlying operating system.  If a JAVA_HOME environment variable is
-   * currently set, then its value will be used.  Otherwise, it will be
-   * dynamically determined from the JVM properties.
+   * be used to set the OPENDS_JAVA_HOME environment variable in a form suitable
+   * for the underlying operating system.  If a OPENDS_JAVA_HOME environment
+   * variable is currently set, then its value will be used.  Otherwise, it will
+   * be dynamically determined from the JVM properties.
    * <BR><BR>
    * Note that if the target file that would be written already exists, then
    * this method will exit without doing anything and leaving the existing file
@@ -239,10 +244,10 @@
    * @throws  IOException  If a problem occurs while creating or writing to the
    *                       specified file.
    */
-  public static File writeSetJavaHome(String serverRoot)
+  public static File writeSetOpenDSJavaHome(String serverRoot)
          throws IOException
   {
-    String javaHome = System.getenv("JAVA_HOME");
+    String javaHome = System.getenv("OPENDS_JAVA_HOME");
     if ((javaHome == null) || (javaHome.length() == 0))
     {
       javaHome = System.getProperty("java.home");
@@ -262,7 +267,7 @@
 
       BufferedWriter writer =
            new BufferedWriter(new FileWriter(setJavaHomeFile));
-      writer.write("set JAVA_HOME=" + javaHome);
+      writer.write("set OPENDS_JAVA_HOME=" + javaHome);
       writer.newLine();
       writer.close();
     }
@@ -279,9 +284,9 @@
       writer.write("#!/bin/sh");
       writer.newLine();
       writer.newLine();
-      writer.write("JAVA_HOME=" + javaHome);
+      writer.write("OPENDS_JAVA_HOME=" + javaHome);
       writer.newLine();
-      writer.write("export JAVA_HOME");
+      writer.write("export OPENDS_JAVA_HOME");
       writer.newLine();
       writer.close();
     }

--
Gitblit v1.10.0