I have created an installer using Inno Setup in which I am executing an exe that I created to create a small service inside Windows XP. I need to pass two arguments to the exe - "-install" and the path of the installation directory. I have no way of expanding the constant {app} to pass the actual value inside of {app}. Is there some way of doing this?
Thanks
I do not really understand what you want, but maybe you are seeking the ExpandConstant function?
This should work:
[Run]
Filename: {app}\MyApp.exe; Parameters: "-install {app}";
I've done it before using InnoSetup and it puts the correct value for {app}.
If you are still having problems, please post your code.
Related
Could someone give an example of how to load and execute .lua script files in windows. I am using ServiceStack redis to loadluascript. It works to certain scripts which don't have module(...) like things.
I am getting this error
Error compiling script (new function): user_script:5: cannot use '...' outside a
vararg function near '...' , sPort: 61688, LastCommand:
Any help by giving an example would be highly appreciated.
Thanks in advance
It would help if you posted the Lua script you are trying to load or execute.
Three dots don't have anything to do with modules:
Vararg expressions, denoted by three dots ('...'), can only be used
when directly inside a vararg function
I guess this answers your question: your Lua code is simply invalid.
Speaking of modules: you can't load your own modules in Redis Lua, which you might already know. See http://redis.io Scripting.
The solution for the above kind Lua script is to prepend local before a function or all variables. I took out the module thing and tweaked the Lua script to make it work. Later I realized the script will not be any use to me :). Thanks for looking into this post.
I'd like to pass properties(-Dname=val) down to junit&java tasks from the Ant command line. The problem is the -3rd party- build file doesn't pass those properties down.
I was thinking ant.build.clonevm could help, but the manual says
Note that this has to be a system property, so it cannot be specified
on the Ant command line.
So, can I use this for the above purpose, and how? If not, any other alternatives?
Thanks for any hints.
Use the ANT_OPTS environment variable instead.
set ANT_OPTS=-Dxxx=value
xxx is your property
Do you know the right method to get the installer path in Inno Setup?
I want to catch that value inside the [Code] section.
{srcexe} will give you the path and filename of the setup.
{src} will give you just the installer path.
You should use the {srcexe} constant. In Pascal scripting, you can obtain the values of constants using the ExpandConstant function, as in
path := ExpandConstant('{srcexe}');
I have a Deplhi based Windows Service that, on installation, parses some command line arguments. I want those arguments to be added to the services command line (ImagePath value on the registry) so that the service is always started with them.
How can I accomplish this?
I want the regedit look like this:
at registry key HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\MyService
ImagePath = C:\Path\to\my\service.exe -some -arguments
Thanks
Update: The installation is done with >MyService.exe /install -some -arguments. Those arguments are the ones I want to persist in the command line.
Update: I found a solution by writing directly to the registry (see here), but I'd still like a more elegant solution, like using some TService property or something of that sort. Thanks!
Ok, after some research, I gave up on an elegant approach, and took the straight-forward path of writing directly to the registry.
To make things simple, I did this: I store the arguments I wanted to pass in variables on my TService. Then, I set the AfterInstall event to write directly into the registry (using a TRegistry object) the exact command line I wanted.
uses Registry;
procedure MyService.AfterInstall(Sender: TObject) ;
var
reg:TRegistry;
begin
reg := TRegistry.Create;
try
reg.RootKey := 'HKEY_LOCAL_MACHINE';
if reg.OpenKey('SYSTEM\CurrentControlSet\Services\MyService', True) then
begin
reg.WriteExtendString ('ImagePath', ParamStr(0) + ' -some -arguments') ;
reg.CloseKey;
end;
finally
reg.Free;
end;
end;
Not the elegant solution I was looking for, but it does the job.
Thanks for the other answers through!
Service arguments can be passed in the lpBinaryPathName argument to the CreateService function. In Delphi's TService, this is called inside TServiceApplication.RegisterServices.InstallService, which you cannot override (easily).
Therefore, I suspect the easiest way to do this is going to be to handle the TService.AfterInstall event and update the registry yourself via ChangeServiceConfig.
I Just found out something little surprising, could be worthful to share.
You can specify parameters for Windows services in (at least) following ways:
Enter it in the Service Manager GUI as "Startparameter".
Pass it as arguments to: sc.exe YourService param1 param2
Enter it in registry in entry ImagePath=..\YourService.exe param1 param2
In Delphi there are 2 ways to query application/service parameters:
System.ParamCount/System.ParamStr: This way you get the parameters of 3. above.
TService.ParamCount/TService.Param[]: This way you get the parameters of 1. and 2. above.
You should use the SCM API to properly install the service and configure it. SC.EXE is a command line interface to the SCM API. You should not manipulate the registry directly in this situation, it works but it also depends which permission the service account has.
Anyway I wonder why you need command line arguments if you embed them in the code - usually those arguments are set outside the service (by an installer, configurator, whatever) to change the service behaviour.
I don't think you can make the service start with them, but if you store those parameters in the registry you can modify the program to on future starts always go and grab them. (i.e. if ParamCount = 0 then retrieve params from registry)
Pablo,
I had the same question and couldn't find anything and went the route of editing the registry as well.
In addition, I use Custom Actions also to create additional install directories and copy files (in C#).
Your suggestion was helpful and I stopped looking for an "elegant" way as well.
thanks
In most modern IDEs there is a parameter that you can set to ensure javac gets enough heap memory to do its compilation. For reasons that are not worth going into here, we are tied for the time being to JBuilder 2005/2006, and it appears the amount of source code has exceeded what can be handled by javac.
Please keep the answer specific to JBuilder 2005/2006 javac (we cannot migrate away right now, and the Borland Make compiler does not correctly support Java 1.6)
I realize how and what parameters should be passed to javac, the problem is the IDE doesn't seem to allow these to be set anywhere. A lot of configuration is hidden down in the Jbuilder Install\bin*.config files, I feel the answer may be in there somewhere, but have not found it.
did you find a good solution for that problem?
I have the same problem and the only solution I found is the following:
The environment variable JAVA_TOOL_OPTIONS can be used to provide parameters for the JVM.
http://java.sun.com/javase/6/docs/platform/jvmti/jvmti.html#tooloptions
I have created a batch file "JBuilderw.bat" with the following content:
set JAVA_TOOL_OPTIONS=-Xmx256m
JBuilderw.exe
Each time I start JBuilder using this batch file the env.var. JAVA_TOOL_OPTIONS will be set and javac.exe will receive the setting.
The JVM displays at the end the following message: "Picked up JAVA_TOOL_OPTIONS: -Xmx256m"
Drawback: all virtual machines started by JBuilder will get that setting. :(
Thanks,
JB
Have a look at http://javahowto.blogspot.com/2006/06/fix-javac-java-lang-outofmemoryerror.html
The arguments that you need to pass to JBuilder's javac is "-J-Xms256m -J-Xmx256m". Replace the 256m with whatever is appropriate in your case. Also, remove the quotes.
This should work for java 1.4, java 1.5 and forward.
BR,
~A
"I realize how and what parameters should be passed to javac, the problem is the IDE doesn't seem to allow these to be set anywhere."
I realized now that you know how to pass the right arguments ONLY not where/how to pass those arguments :-(
How about this : Can you locate where is the JAVA_HOME/bin directory that borland uses ? If yes, then you can rename the javac.exe(to say javacnew.exe) with a javac.bat which in turn will call the javacnew.exe (as well as pass the required arguments) ?
I don't know if this will help since I don't use Borland but in Eclipse, this is a setting that you attach to the program you're going to run. Each program you run in the IDE has configuration specific to it, including arguments to the VM. Is there something like that?
Do you have a jdk.config file located in JBuilder2005/bin/?
You should be able to modify vm parameters in that file like:
vmparam -Xms256m
vmparam -Xmx256m
Let me know if this works, I found it on a page talking about editing related settings in JBuilder 2005.
Edit the jbuilder.config file.
Put in comment those two lines:
vmmemmax 75%
vmmemmin 32m
has they ought to be <1Gb and with a > 1Gb PC , 75% is too big?