Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to run a .jar file from C++

Posted on 2003-03-19
4
Medium Priority
?
2,119 Views
Last Modified: 2012-05-04
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?...
0
Comment
Question by:balajicre
3 Comments
 
LVL 2

Accepted Solution

by:
somchaiu earned 160 total points
ID: 8171130
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.
0
 
LVL 1

Assisted Solution

by:igor_sk
igor_sk earned 140 total points
ID: 8171570
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).
0
 

Expert Comment

by:CleanupPing
ID: 9446978
balajicre:
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 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Make the most of your online learning experience.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question