--打包一个由jdk1.5,tomcat5.5下开发的项目,以前tomcat 4.1下很好处理jdk路径问题,只需要在startup.bat和shutdown.bat文件中加入如下两句就可以了:
set CATALINA_HOME=..//在这句下面加入
//设定jdk的路径
set JAVA_HOME=..\..\%CATALINA_HOME%\jdk1.4
:gotHome //=..//在这句上面加入
但是用了tomcat5.5却没有了这两个文件,它将自已的安装路径和jdk的路径都写到注册表中了.
这就需要在打包时动态的修改注册表,否则将不能正常使用.
-- 安装路径:your_variable
--Dialog.Message(your_variable, your_variable, MB_OK, MB_ICONEXCLAMATION);
-- 创建一个全局变量,并赋予一个字符串
your_variable1 = "";
--Dialog.Message(your_variable, your_variable, MB_OK, MB_ICONEXCLAMATION);
-- 从注册表中导入的值:
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\Apache Software Foundation\\Procrun 2.0");
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\Apache Software Foundation\\Tomcat");
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5");
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\Apache Software Foundation\\Tomcat\\5.5");
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters");
your_variable1=String.Replace("D:\\Software\\Tomcat 5.5","D:\\Software",your_variable,true);
Registry.SetValue(3, "Software\\Apache Software Foundation\\Tomcat\\5.5", "InstallPath", your_variable1, 7);
Registry.SetValue(3, "Software\\Apache Software Foundation\\Tomcat\\5.5", "Version", "5.5.12", 7);
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Java");
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Log");
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Start");
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Stop");
your_variable1=String.Replace("D:\\Software\\jdk1.5\\bin\\client\\jvm.dll","D:\\Software",your_variable,true);
Registry.SetValue(3, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Java", "Jvm",your_variable1, 1);
your_variable1=String.Replace("D:\\Software\\Tomcat 5.5\\bin\\bootstrap.jar","D:\\Software",your_variable,true);
Registry.SetValue(3, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Java", "Classpath",your_variable1, 1);
your_variable1=String.Replace("-Dcatalina.home=D:\\Software\\Tomcat 5.5|-Dcatalina.base=D:\\Software\\Tomcat 5.5|-Djava.endorsed.dirs=D:\\Software\\Tomcat 5.5\\common\\endorsed|-Djava.io.tmpdir=D:\\Software\\Tomcat 5.5\\temp|-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager|-Djava.util.logging.config.file=D:\\Software\\Tomcat 5.5\\conf\\logging.properties","D:\\Software",your_variable,true);
Registry.SetValue(3, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Java", "Options", your_variable1, 7);
your_variable1=String.Replace("D:\\Software\\Tomcat 5.5\\logs","D:\\Software",your_variable,true);
Registry.SetValue(3, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Log", "Path",your_variable1 , 1);
Registry.SetValue(3, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Log", "StdError", "auto", 1);
Registry.SetValue(3, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Log", "StdOutput", "auto", 1);
your_variable1=String.Replace("D:\\Software\\Tomcat 5.5","D:\\Software",your_variable,true);
Registry.SetValue(3, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Start", "WorkingPath", your_variable1, 1);
Registry.SetValue(3, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Start", "Class", "org.apache.catalina.startup.Bootstrap", 1);
Registry.SetValue(3, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Start", "Params", "start", 7);
Registry.SetValue(3, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Start", "Mode", "jvm", 1);
your_variable1=String.Replace("D:\\Software\\Tomcat 5.5","D:\\Software",your_variable,true);
Registry.SetValue(3, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Stop", "WorkingPath", your_variable1, 1);
Registry.SetValue(3, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Stop", "Class", "org.apache.catalina.startup.Bootstrap", 1);
Registry.SetValue(3, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Stop", "Params", "stop", 7);
Registry.SetValue(3, "Software\\Apache Software Foundation\\Procrun 2.0\\Tomcat5\\Parameters\\Stop", "Mode", "jvm", 1);
-- 从注册表中导入的值:
Registry.SetValue(3, "SYSTEM\\CurrentControlSet\\Services\\Tomcat5", "Type", "16", 4);
Registry.SetValue(3, "SYSTEM\\CurrentControlSet\\Services\\Tomcat5", "Start", "3", 4);
Registry.SetValue(3, "SYSTEM\\CurrentControlSet\\Services\\Tomcat5", "ErrorControl", "1", 4);
your_variable1=String.Replace("\"D:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\bin\\Tomcat5.exe\" //RS//Tomcat5","D:\\Program Files\\Apache Software Foundation",your_variable,true);
Registry.SetValue(3, "SYSTEM\\CurrentControlSet\\Services\\Tomcat5", "ImagePath", your_variable1, 2);
Registry.SetValue(3, "SYSTEM\\CurrentControlSet\\Services\\Tomcat5", "DisplayName", "Apache Tomcat", 7);
Registry.SetValue(3, "SYSTEM\\CurrentControlSet\\Services\\Tomcat5", "ObjectName", "LocalSystem", 7);
Registry.SetValue(3, "SYSTEM\\CurrentControlSet\\Services\\Tomcat5", "Description", "Apache Tomcat 5.5.12 Server - http://tomcat.apache.org/", 7);
Registry.CreateKey(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tomcat5\\Enum");
Registry.CreateKey(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tomcat5\\Parameters");
Registry.CreateKey(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tomcat5\\Security");
Registry.SetValue(3, "SYSTEM\\CurrentControlSet\\Services\\Tomcat5\\Enum", "0", "Root\\LEGACY_Tomcat5\\0000", 7);
Registry.SetValue(3, "SYSTEM\\CurrentControlSet\\Services\\Tomcat5\\Enum", "Count", "1", 4);
Registry.SetValue(3, "SYSTEM\\CurrentControlSet\\Services\\Tomcat5\\Enum", "NextInstance", "1", 4);
Registry.SetValue(3, "SYSTEM\\CurrentControlSet\\Services\\Tomcat5\\Security", "Security", "01 00 14 80 90 00 00 00 9C 00 00 00 14 00 00 00 30 00 00 00 02 00 1C 00 01 00 00 00 02 80 14 00 FF 01 0F 00 01 01 00 00 00 00 00 01 00 00 00 00 02 00 60 00 04 00 00 00 00 00 14 00 FD 01 02 00 01 01 00 00 00 00 00 05 12 00 00 00 00 00 18 00 FF 01 0F 00 01 02 00 00 00 00 00 05 20 00 00 00 20 02 00 00 00 00 14 00 8D 01 02 00 01 01 00 00 00 00 00 05 0B 00 00 00 00 00 18 00 FD 01 02 00 01 02 00 00 00 00 00 05 20 00 00 00 23 02 00 00 01 01 00 00 00 00 00 05 12 00 00 00 01 01 00 00 00 00 00 05 12 00 00 00", 3);
posted on 2007-03-25 00:41
JJCEA 阅读(5445)
评论(0) 编辑 收藏 所属分类:
学习日记