How to run a .jar file from C++

I have a C++ Application from which i would like to start a .jar file. I tried to use the createprocess function and passed the string as javaw -jar Myfile.jar But it doesnt work that way, eventhough it works for an .exe file. Is there a way to start up my application from C++. Can any body help me with this?...
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You do not run the jar file. You run javaw.exe, so this should work. However, you have to assign the correct "current directory" for the new process too. Generally, you change to the directory of jar file because launch another process.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You should build command line, which includes full path to your javaw.exe, your class path and class that you will run. It should be somthing like this:

C:\jdk1.3.1_02\jre\bin\javaw.exe -cp <your jar file path> <class name>

This will be the command that you will execute from you program using WinExec() Win API function (I guess you use Windows).
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.