FR: 2805307 Add support for OpenJDK
https://sourceforge.net/tracker/?func=detail&aid=2805307&group_id=176962&atid=879335
This commit is contained in:
parent
a561d80971
commit
d34be4e2c7
|
@ -0,0 +1,116 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.install;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.compiere.util.CLogMgt;
|
||||
|
||||
|
||||
/**
|
||||
* Open JDK JVM Configuration
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @author Trifon Trifonov
|
||||
*/
|
||||
public class ConfigVMOpenJDK extends Config
|
||||
{
|
||||
/**
|
||||
* @param data configuration
|
||||
*/
|
||||
public ConfigVMOpenJDK (ConfigurationData data)
|
||||
{
|
||||
super (data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Init
|
||||
*/
|
||||
public void init()
|
||||
{
|
||||
// Java Home, e.g. D:\j2sdk1.4.1\jre
|
||||
String javaHome = System.getProperty("java.home");
|
||||
log.fine(javaHome);
|
||||
if (javaHome.endsWith("jre"))
|
||||
javaHome = javaHome.substring(0, javaHome.length()-4);
|
||||
p_data.setJavaHome(javaHome);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test
|
||||
* @return error message or null of OK
|
||||
*/
|
||||
public String test()
|
||||
{
|
||||
// Java Home
|
||||
File javaHome = new File (p_data.getJavaHome());
|
||||
boolean pass = javaHome.exists();
|
||||
String error = "Not found: Java Home";
|
||||
if (getPanel() != null)
|
||||
signalOK(getPanel().okJavaHome, "ErrorJavaHome",
|
||||
pass, true, error);
|
||||
if (!pass)
|
||||
return error;
|
||||
/** Different VM structure
|
||||
File tools = new File (p_data.getJavaHome()
|
||||
+ File.separator + "lib" + File.separator + "tools.jar");
|
||||
pass = tools.exists();
|
||||
error = "Not found: Java SDK = " + tools;
|
||||
signalOK(getPanel().okJavaHome, "ErrorJavaHome",
|
||||
pass, true, error);
|
||||
if (!pass)
|
||||
return error;
|
||||
**/
|
||||
if (CLogMgt.isLevelFinest())
|
||||
CLogMgt.printProperties(System.getProperties(), "System", true);
|
||||
//
|
||||
log.info("OK: JavaHome=" + javaHome.getAbsolutePath());
|
||||
setProperty(ConfigurationData.JAVA_HOME, javaHome.getAbsolutePath());
|
||||
System.setProperty(ConfigurationData.JAVA_HOME, javaHome.getAbsolutePath());
|
||||
|
||||
// Java Version
|
||||
final String VERSION = "1.5.0";
|
||||
final String VERSION2 = "1.6.0";
|
||||
pass = false;
|
||||
String jh = javaHome.getAbsolutePath();
|
||||
if (jh.indexOf(VERSION) != -1) // file name has version = assuming OK
|
||||
pass = true;
|
||||
if (!pass && jh.indexOf(VERSION2) != -1) //
|
||||
pass = true;
|
||||
String thisJH = System.getProperty("java.home");
|
||||
if (thisJH.indexOf(jh) != -1) // we are running the version currently
|
||||
{
|
||||
String thisJV = System.getProperty("java.version");
|
||||
pass = thisJV.indexOf(VERSION) != -1;
|
||||
if (!pass && thisJV.indexOf(VERSION2) != -1)
|
||||
pass = true;
|
||||
if (pass)
|
||||
log.info("OK: Version=" + thisJV);
|
||||
}
|
||||
error = "Wrong Java Version: Should be " + VERSION2;
|
||||
if (getPanel() != null)
|
||||
signalOK(getPanel().okJavaHome, "ErrorJavaHome",
|
||||
pass, true, error);
|
||||
if (!pass)
|
||||
return error;
|
||||
//
|
||||
setProperty(ConfigurationData.JAVA_TYPE, p_data.getJavaType());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -107,7 +107,7 @@ public class ConfigurationData
|
|||
/** */
|
||||
public static final String ADEMPIERE_SSL_PORT = "ADEMPIERE_SSL_PORT";
|
||||
/** */
|
||||
public static final String ADEMPIERE_WEB_ALIAS = "ADEMPIERE_WEB_ALIAS";
|
||||
public static final String ADEMPIERE_WEB_ALIAS = "ADEMPIERE_WEB_ALIAS";
|
||||
|
||||
/** */
|
||||
public static final String ADEMPIERE_KEYSTORE = "ADEMPIERE_KEYSTORE";
|
||||
|
@ -136,7 +136,7 @@ public class ConfigurationData
|
|||
public static final String ADEMPIERE_DB_PATH = "ADEMPIERE_DB_PATH";
|
||||
/** */
|
||||
/** */
|
||||
public static final String ADEMPIERE_DB_SERVER = "ADEMPIERE_DB_SERVER";
|
||||
public static final String ADEMPIERE_DB_SERVER = "ADEMPIERE_DB_SERVER";
|
||||
/** */
|
||||
public static final String ADEMPIERE_DB_PORT = "ADEMPIERE_DB_PORT";
|
||||
/** */
|
||||
|
@ -149,27 +149,27 @@ public class ConfigurationData
|
|||
/** */
|
||||
public static final String ADEMPIERE_DB_PASSWORD = "ADEMPIERE_DB_PASSWORD";
|
||||
/** */
|
||||
public static final String ADEMPIERE_DB_SYSTEM = "ADEMPIERE_DB_SYSTEM";
|
||||
public static final String ADEMPIERE_DB_SYSTEM = "ADEMPIERE_DB_SYSTEM";
|
||||
|
||||
/** */
|
||||
public static final String ADEMPIERE_MAIL_SERVER = "ADEMPIERE_MAIL_SERVER";
|
||||
/** */
|
||||
public static final String ADEMPIERE_MAIL_USER = "ADEMPIERE_MAIL_USER";
|
||||
public static final String ADEMPIERE_MAIL_USER = "ADEMPIERE_MAIL_USER";
|
||||
/** */
|
||||
public static final String ADEMPIERE_MAIL_PASSWORD = "ADEMPIERE_MAIL_PASSWORD";
|
||||
public static final String ADEMPIERE_MAIL_PASSWORD = "ADEMPIERE_MAIL_PASSWORD";
|
||||
/** */
|
||||
public static final String ADEMPIERE_ADMIN_EMAIL = "ADEMPIERE_ADMIN_EMAIL";
|
||||
/** */
|
||||
public static final String ADEMPIERE_MAIL_UPDATED = "ADEMPIERE_MAIL_UPDATED";
|
||||
|
||||
/** */
|
||||
public static final String ADEMPIERE_FTP_SERVER = "ADEMPIERE_FTP_SERVER";
|
||||
public static final String ADEMPIERE_FTP_SERVER = "ADEMPIERE_FTP_SERVER";
|
||||
/** */
|
||||
public static final String ADEMPIERE_FTP_USER = "ADEMPIERE_FTP_USER";
|
||||
/** */
|
||||
public static final String ADEMPIERE_FTP_PASSWORD = "ADEMPIERE_FTP_PASSWORD";
|
||||
/** */
|
||||
public static final String ADEMPIERE_FTP_PREFIX = "ADEMPIERE_FTP_PREFIX";
|
||||
public static final String ADEMPIERE_FTP_PREFIX = "ADEMPIERE_FTP_PREFIX";
|
||||
|
||||
/** */
|
||||
public static final String ADEMPIERE_WEBSTORES = "ADEMPIERE_WEBSTORES";
|
||||
|
@ -934,12 +934,15 @@ public class ConfigurationData
|
|||
private static String JAVATYPE_MAC = "mac";
|
||||
/** IBM VM */
|
||||
private static String JAVATYPE_IBM = "<ibm>";
|
||||
/** Open JDK */
|
||||
private static String JAVATYPE_OPENJDK = "OpenJDK";
|
||||
/** Java VM Types */
|
||||
static String[] JAVATYPE = new String[]
|
||||
{JAVATYPE_SUN, JAVATYPE_MAC, JAVATYPE_IBM};
|
||||
/** Database Configs */
|
||||
{JAVATYPE_SUN, JAVATYPE_OPENJDK, JAVATYPE_MAC, JAVATYPE_IBM};
|
||||
|
||||
/** Virtual machine Configurations */
|
||||
private Config[] m_javaConfig = new Config[]
|
||||
{new ConfigVMSun(this), new ConfigVMMac(this), null};
|
||||
{new ConfigVMSun(this), new ConfigVMOpenJDK(this), new ConfigVMMac(this), null};
|
||||
|
||||
/**
|
||||
* Init Database
|
||||
|
|
Loading…
Reference in New Issue