Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
1.20/5 (2 votes)
See more:
Hi,

I want to create a windows service that simulates the command below:

"java -server -Xms128M -Xmx256m -XX:MaxPermSize=256m -XX:+UseParallelGC -XX:+UseAdaptiveSizePolicy -classpath ..\config\;..\lib\activation.jar;.........TaskControllerService"


How do I achieve it?

Regards,
Anju
Posted
Updated 19-Apr-13 23:32pm
v2
Comments
Dave Kreskowiak 11-Apr-13 8:16am    
and for the people who don't want to execute that pile of crap, what does it do, exactly??
AmitGajjar 11-Apr-13 8:24am    
what is simulating command ?
[no name] 11-Apr-13 10:06am    
This is not a question or a description of any kind of a problem.

1 solution

I don't understand what you mean with "windows service". However, you can run shell commands with parameters by using the "System.Diagnostic" class. Take a look at this.

How to Execute a Command in C# ?[^]
 
Share this answer
 
Comments
anju_g 11-Apr-13 10:56am    
Windows Service is something that you see when you open services.msc ...
TaskControllerService is .bat file that calls an exe .
"-Xms128M -Xmx256m -XX:MaxPermSize=256m -XX:+UseParallelGC" -> parameters for setting heap size etc.


"-classpath ..\config\;..\lib\activation.jar;..\lib\ant-1.5.3.jar;..\lib\ant-optional-1.5.3.jar;..\lib\bcel.jar;..\lib\c3p0-0.9.1.2.ja" ---> the classpath that specifies the necessary jars required to call the .exe. ..

I tried this command :
sc create taskcontroller binPath= "D:\GvtTrunk\Server\deploy
\bin\TaskControllerService64.bat" ---> this is a utility for creating a windows service .The service got created successfully. But, on starting it, it threw some .net framework related error ...

I wonder if there are any simpler methods other than the one I found here ...http://stackoverflow.com/questions/569606/how-can-i-make-service-apps-with-visual-c-sharp-express..
anju_g 11-Apr-13 11:05am    
This link also was useful..
http://msdn.microsoft.com/en-us/library/76477d2t.aspx
but got stuck when I got to the classpath part..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900