|
From: Mikkel D. <mi...@co...> - 2003-02-01 09:46:47
|
When I test my program running as a service I can not have a script starting it. It is started by the service manager and not in a command prompt. If I change an environment variable in windows, my program (running as a service) wont be able to see until i reboot windows. This is true for NT, 2000 and XP. If I specify wrapper.java.additional.1 on the command line, I can not use it in the wrapper.conf file as %JAVA_HOME% in defining fx wrapper.java.command=%JAVA_HOME%/bin/java ! /Mikkel ----- Original Message ----- From: "Leif Mortenson" <le...@ta...> To: "Wrapper User List" <wra...@li...> Sent: Saturday, February 01, 2003 5:00 AM Subject: Re: Defining enviroment variable on the command line. > Mikkel, > Thanks for your work here. But I think there are already a couple > ways to handle > this. :-) > > To set an environment variable on Windows or Unix, the typical > method is to > simply set the variable in the script file used to launch the Wrapper. > Something > like this: > > --- > set JAVA_HOME=C:\devtools\jdk1.4.1 > set PROJECT_HOME=c:\myproject\sompath > wrapper.exe -i c:\myproject\somepath\conf\wrapper.conf > --- > > If you only need to see the environment variables from within Java, then > a second way of doing this is to either set the variables in the > wrapper.conf > file: > --- > wrapper.java.additional.1=-DJAVA_JOME=C:\devtools\jdk1.4.1 > wrapper.java.additional.2=-DPROJECT_HOME=c:\myproject\sompath > --- > > Or you can do the same thing from the command line, if that is what you > prefer: (All one line ) > --- > wrapper.exe -i c:\myproject\somepath\conf\wrapper.conf > wrapper.java.additional.1=-DJAVA_JOME=C:\devtools\jdk1.4.1 > wrapper.java.additional.2=-DPROJECT_HOME=c:\myproject\sompath > --- > > What version of Windows are using? In the NT based windows > versions (2000, XP) You simply have to open up a new command > prompt after changing system wide environment variables. Existing > command prompts will be unaffected. > > Cheers, > Leif > > Mikkel Damsgaard wrote: > > > I hacked the wrapper_win.c code to add support for a -d option, to define > > additional environment variable on the command line to wrapper. > > > > ie: > > > > wrapper -i c:\myproject\somepath\conf\wrapper.conf wrapper.debug=true > > -d:PROJECT_HOME=c:\myproject\sompath -d:JAVA_HOME=C:\devtools\jdk1.4.1 > > > > where the order of arguments after the config file is irrelevant. > > > > The main reason for this is that when developing under windows I have > > to reboot the machine before the services "sees" changes in > > environment variables > > and it is much more convenient to specify it at the command line to > > wrapper. > > > > Futhermore I have several similar services running and it is nice to > > be able to change > > behaviour based on variables set on the commandline. > > > > What do you think? > > > > /Mikkel > > > > Attached: modified version of wrapper_win.c and also Makefile.win32 > > > > > > |