Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was hoping for some help on what seemed like a simple issue but I can't find a solution. I am not a coder, I work IT and learned how to code years ago and use it for system maintenance.

I am automating an installer for Oracle 11g so it can be pushed through SCCM or run manually without the techs needing to select options or follow instructions. There were no problems with the Oracle 11g install, I created a process and told it to start and used a response file and it installs properly and works as it should.

My problem is I need to copy the 'tnsnames.ora' configuration file to the newly created Oracle directory structure and this is where the issue comes about. When I use the Start process command I am launching 'oui.exe' which runs for roughly a minute and then passes control over to 'javaw.exe' which does the install. Just after oui.exe passes control to javaw.exe the original process oui.exe terminates and only javaw.exe is left running.

Because my Process.WaitForExit() is tied to oui.exe I have no way to tell when the application is installed so I can copy my config file over. When I search on this issue the answers I find are all pointing to processes that users initiate and not ones the installer initiates. Other than having the code wait for a number of minutes until it should be safely installed is there a way for me to see when javaw.exe has finished so I can copy my config file?

Thanks for any help with this issue.

I am coding this using Visual Studio 2010 using C# and .NET 4 and it is for Windows 7 machines.
Posted
Comments
[no name] 3-Jul-14 17:00pm    
You can get a list of the running processes and poll the list until the java application exits but that might not be the best idea.

Try something like this:

C#
// start your "oui" process and wait for it to pass control to javaw.exe
Process oui = Process.Start("oui.exe");
oui.WaitForexit();

// grab processes with the name "javaw"
Process[] processes = Process.GetProcessesByName("javaw");

// if you found one, create a Process instance for it and wait until it exits
if (processes.Length > 0)
{
    Process javaw = processes[0];
    javaw.WaitForExit();
}

else
{
    // TODO: add code to run if the javaw process is not found
}
 
Share this answer
 
Thank you very much for the replies, because this is just for software deployment to make life easy this will work perfectly.

Thanks again for the help.
 
Share this answer
 

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