IDEMPIERE-2503:Keytool change package name in java8

This commit is contained in:
hieplq 2015-03-07 10:38:48 +07:00
parent 05c145002e
commit 502cddbc9d
1 changed files with 11 additions and 3 deletions

View File

@ -19,6 +19,7 @@ package org.compiere.install;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.lang.reflect.Method;
import java.net.InetAddress; import java.net.InetAddress;
import java.security.Key; import java.security.Key;
import java.security.KeyStore; import java.security.KeyStore;
@ -34,8 +35,6 @@ import org.compiere.Adempiere;
import org.compiere.util.CLogMgt; import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import sun.security.tools.KeyTool;
/** /**
* Class to manage SSL KeyStore * Class to manage SSL KeyStore
* *
@ -460,7 +459,16 @@ public class KeyStoreMgt
//vpj-cd add support java 6 //vpj-cd add support java 6
try try
{ {
KeyTool.main(args); Class<?> keyTool = null;
try{
// java 7
keyTool = Class.forName("sun.security.tools.KeyTool");
}catch (ClassNotFoundException ex){
// java 8
keyTool = Class.forName("sun.security.tools.keytool.Main");
}
Method mainMethod = keyTool.getDeclaredMethod("main", String[].class);
mainMethod.invoke(null, new Object[]{args});
} }
catch (Exception e) catch (Exception e)
{ {