Java Application as NT Service

S

Shahaji

Hi
I want to start Java Application as NT Service
I have Set CP as System Envn Variable.
But createprocess API is not picking value of the same.
It is giving NoClass Def found Error

void main(int argc,char*argv[])
{
memset(&si, 0, sizeof(si));
memset(&pi, 0, sizeof(pi));
if(!CreateProcess(NULL, // No module name (use command line).
//"C:\\Program Files\\Java\\j2re1.4.2_03\\bin\\java
C:\\TIBCO\\TIBRV\\TIBRVJ.JAR;C:\\TIBCO\\TIBRV\\JAVA\\RVJPRO.JAR;C:\\TIBCO\\TIBRV\\LIB\\tibrvj.jar;c:\\tibco\\adapter\\siebel\\ontrack\\jar\\ddgsoa.jar;c:\\tibco\\adapter\\siebel\\ontrack\\jar\\Jakarta-regexp1.2.jar
C:\\tibco\\adapter\\siebel\\Ontrack\\Application\\crmquery\\lib\\fsdk.jar;C:\\tibco\\adapter\\siebel\\Ontrack\\Application\\crmquery\\lib\\common.jar;C:\\tibco\\adapter\\siebel\\Ontrack\\Application\\crmquery\\lib\\crmquery.jar;C:\\tibco\\adapter\\siebel\\Ontrack\\Application\\crmquery\\lib\\jgl3.1.0.jar;C:\\tibco\\adapter\\siebel\\Ontrack\\Application\\crmquery\\lib\\jaxp.jar;C:\\tibco\\adapter\\
iebel\\Ontrack\\Application\\crmquery\\lib\\crimson.jar;C:\\tibco\\adapter\\siebel\\Ontrack\\Application\\crmquery\\lib\\jakarta-regexp-1.2.jar;
coza.ddaim.crmquery.Main -name CrmQuery -cf
C:\\tibco\\adapter\\siebel\\Ontrack\\Application\\crmquery\\etc\\config.xml"
,
"C:\\Program Files\\Java\\j2re1.4.2_03\\bin\\java -classpath %CP%
C:\\TIBCO\\adapter\\siebel\\ontrack\\application\\crmquery\\lib\\crmquery.jar
coza.ddaim.crmquery.Main -name CrmQuery -cf
C:\\tibco\\adapter\\siebel\\Ontrack\\Application\\crmquery\\etc\\config.xml",
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi) // Pointer to PROCESS_INFORMATION structure.
)
{
printf("CreateProcess failed." );
}
else
{
printf("Process Created");
}
WaitForSingleObject(pi.hProcess,INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
Sleep(20000);
getch();
}


**Shaha
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top